This repository has been archived by the owner on Jul 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy patheva.api.html
40 lines (40 loc) · 20.9 KB
/
eva.api.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>EVA API Docs</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="highlight/solarized-light.css" /><script type="text/javascript" src="highlight/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a> with <a href="https://github.com/xsc/codox-theme-rdash">RDash UI</a> theme</h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Eva</span> </span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1 current"><a href="eva.api.html"><div class="inner"><span>eva.api</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="eva.api.html#var-as-of"><div class="inner"><span>as-of</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-as-of-t"><div class="inner"><span>as-of-t</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-attribute"><div class="inner"><span>attribute</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-attribute-strict"><div class="inner"><span>attribute-strict</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-basis-t"><div class="inner"><span>basis-t</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-connect"><div class="inner"><span>connect</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-connect*"><div class="inner"><span>connect*</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-connection-status"><div class="inner"><span>connection-status</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-datoms"><div class="inner"><span>datoms</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-db"><div class="inner"><span>db</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-db-snapshot"><div class="inner"><span>db-snapshot</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-entid"><div class="inner"><span>entid</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-entid-strict"><div class="inner"><span>entid-strict</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-entity"><div class="inner"><span>entity</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-entity-db"><div class="inner"><span>entity-db</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-extant-entity.3F"><div class="inner"><span>extant-entity?</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-function"><div class="inner"><span>function</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-history"><div class="inner"><span>history</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-ident"><div class="inner"><span>ident</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-ident-strict"><div class="inner"><span>ident-strict</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-invoke"><div class="inner"><span>invoke</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-latest-t"><div class="inner"><span>latest-t</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-log"><div class="inner"><span>log</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-part"><div class="inner"><span>part</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-pull"><div class="inner"><span>pull</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-pull-many"><div class="inner"><span>pull-many</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-q"><div class="inner"><span>q</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-release"><div class="inner"><span>release</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-resolve-tempid"><div class="inner"><span>resolve-tempid</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-snapshot-t"><div class="inner"><span>snapshot-t</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-squuid"><div class="inner"><span>squuid</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-squuid-time-millis"><div class="inner"><span>squuid-time-millis</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-sync-db"><div class="inner"><span>sync-db</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-tempid"><div class="inner"><span>tempid</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-to-tx-eid"><div class="inner"><span>to-tx-eid</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-to-tx-num"><div class="inner"><span>to-tx-num</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-touch"><div class="inner"><span>touch</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-transact"><div class="inner"><span>transact</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-transact-async"><div class="inner"><span>transact-async</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-tx-range"><div class="inner"><span>tx-range</span></div></a></li><li class="depth-1"><a href="eva.api.html#var-with"><div class="inner"><span>with</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">eva.api</h1><div class="doc"><div class="markdown"></div></div><div class="public anchor" id="var-as-of"><h3>as-of</h3><div class="usage"><code>(as-of db t)</code></div><div class="doc"><div class="markdown"><p>Returns a historical database value at some point in time <code>t</code>, inclusive. <code>t</code> can be a transaction number or a transaction id</p></div></div></div><div class="public anchor" id="var-as-of-t"><h3>as-of-t</h3><div class="usage"><code>(as-of-t db)</code></div><div class="doc"><div class="markdown"><p>If <code>db</code> isn’t the latest snapshot at the time it was constructed, return the <code>tx-num</code> of the log entry / transaction that <code>db</code> was constructed from to reflect; else <code>nil</code></p></div></div></div><div class="public anchor" id="var-attribute"><h3>attribute</h3><div class="usage"><code>(attribute db attr-id)</code></div><div class="doc"><div class="markdown"><p>Retrieves information about an <code>Attribute</code>.</p></div></div></div><div class="public anchor" id="var-attribute-strict"><h3>attribute-strict</h3><div class="usage"><code>(attribute-strict db attr-id)</code></div><div class="doc"><div class="markdown"><p>Retrieves information about an <code>Attribute</code>. Exception is thrown if none exists</p></div></div></div><div class="public anchor" id="var-basis-t"><h3>basis-t</h3><div class="usage"><code>(basis-t db)</code></div><div class="doc"><div class="markdown"><p>Return the latest <code>tx-num</code> the <code>Peer</code> knew about at the time <code>db</code> was constructed; else <code>nil</code></p></div></div></div><div class="public anchor" id="var-connect"><h3>connect</h3><div class="usage"><code>(connect uri)</code></div><div class="doc"><div class="markdown"><p>Returns a <code>Connection</code>, given a valid connection configuration map.</p></div></div></div><div class="public anchor" id="var-connect*"><h3>connect*</h3><div class="usage"><code>(connect* connect-fn config)</code></div><div class="doc"><div class="markdown"></div></div></div><div class="public anchor" id="var-connection-status"><h3>connection-status</h3><div class="usage"><code>(connection-status conn)</code></div><div class="doc"><div class="markdown"><p>Returns status information on a given <code>Connection</code></p></div></div></div><div class="public anchor" id="var-datoms"><h3>datoms</h3><div class="usage"><code>(datoms db index & components)</code></div><div class="doc"><div class="markdown"><p>Provides raw access to the database indexes. Must pass the index-name. May pass one or more leading components of the index to constrain the results.</p>
<p>The following indexes may be searched:</p>
<ul>
<li><code>:eavt</code> - contains all datoms sorted by entity-id, attribute-id, value, and transaction</li>
<li><code>:aevt</code> - contains all datoms sorted by attribute-id, entity-id, value, and transaction</li>
<li><code>:avet</code> - contains datoms with indexed and unique attributes (except for bytes values) sorted by attribute-id, value, entity-id, and transaction</li>
<li><code>:vaet</code> - contains datoms with attributes of :db.type/ref; VAET acts as the reverse index for backwards traversal of refs</li>
</ul></div></div></div><div class="public anchor" id="var-db"><h3>db</h3><div class="usage"><code>(db conn)</code></div><div class="doc"><div class="markdown"><p>Yields the most recently known database snapshot, which is maintained in memory.</p></div></div></div><div class="public anchor" id="var-db-snapshot"><h3>db-snapshot</h3><div class="usage"><code>(db-snapshot conn)</code></div><div class="doc"><div class="markdown"><p>Yields the most recently known database snapshot, which is maintained in memory.</p></div></div></div><div class="public anchor" id="var-entid"><h3>entid</h3><div class="usage"><code>(entid db identifier)</code></div><div class="doc"><div class="markdown"><p>Coerces any entity-identifier into an entity-id. Does <strong>not</strong> confirm existence of an entity id, except incidentally through some coercion processes. To check for existence of an entity, please use <a href="#var-extant-entity.3F">isExtantEntity</a></p></div></div></div><div class="public anchor" id="var-entid-strict"><h3>entid-strict</h3><div class="usage"><code>(entid-strict db identifier)</code></div><div class="doc"><div class="markdown"><p>Behaves the same as <a href="#var-entid"><code>entid</code></a>, but instead throws where <code>entid</code> would return nil.</p></div></div></div><div class="public anchor" id="var-entity"><h3>entity</h3><div class="usage"><code>(entity db eid)</code></div><div class="doc"><div class="markdown"><p>Returns an <code>Entity</code>, which is a dynamic, lazy-loaded projection of the datoms that share the same entity-id</p></div></div></div><div class="public anchor" id="var-entity-db"><h3>entity-db</h3><div class="usage"><code>(entity-db entity)</code></div><div class="doc"><div class="markdown"><p>Returns the database value that backs this entity</p></div></div></div><div class="public anchor" id="var-extant-entity.3F"><h3>extant-entity?</h3><div class="usage"><code>(extant-entity? db identifier)</code></div><div class="doc"><div class="markdown"><p>Returns true if there exists at least one datom in the database with the provided entity identifier.</p></div></div></div><div class="public anchor" id="var-function"><h3>function</h3><div class="usage"><code>(function m)</code></div><div class="doc"><div class="markdown"><p><a href="https://docs.datomic.com/on-prem/clojure/index.html#datomic.api/function">Datomic Documentation</a></p></div></div></div><div class="public anchor" id="var-history"><h3>history</h3><div class="usage"><code>(history db)</code></div><div class="doc"><div class="markdown"><p>Returns a special view of the database containing <strong>all</strong> datoms, asserted or retracted across time. Currently supports the <a href="#var-datoms"><code>datoms</code></a> and <a href="#var-q"><code>q</code></a> functions.</p></div></div></div><div class="public anchor" id="var-ident"><h3>ident</h3><div class="usage"><code>(ident db id)</code></div><div class="doc"><div class="markdown"><p>Returns the <code>keyword-identifier</code> associated with an id.</p></div></div></div><div class="public anchor" id="var-ident-strict"><h3>ident-strict</h3><div class="usage"><code>(ident-strict db id)</code></div><div class="doc"><div class="markdown"><p>Returns the <code>keyword-identifier</code> associated with an id. Exception is thrown if none exists</p></div></div></div><div class="public anchor" id="var-invoke"><h3>invoke</h3><div class="usage"><code>(invoke db eid-or-ident & args)</code></div><div class="doc"><div class="markdown"><p>Looks up a database function identified by the <code>eid</code> or <code>ident</code> and invokes the function with the provided <code>args</code></p></div></div></div><div class="public anchor" id="var-latest-t"><h3>latest-t</h3><div class="usage"><code>(latest-t conn)</code></div><div class="doc"><div class="markdown"><p>Returns the <code>t</code> of the most recent transaction reachable via this <code>db</code> value.</p></div></div></div><div class="public anchor" id="var-log"><h3>log</h3><div class="usage"><code>(log conn)</code></div><div class="doc"><div class="markdown"><p>Returns the current value of the transaction log.</p>
<p>Communicates with storage, but not with the transactor</p>
<p>Can be used in conjunction with <a href="#var-tx-range"><code>tx-range</code></a> or a <a href="#var-q"><code>query</code></a>.</p></div></div></div><div class="public anchor" id="var-part"><h3>part</h3><div class="usage"><code>(part eid)</code></div><div class="doc"><div class="markdown"><p>Return the partition associated with the specified entity id.</p></div></div></div><div class="public anchor" id="var-pull"><h3>pull</h3><div class="usage"><code>(pull db pattern eid)</code></div><div class="doc"><div class="markdown"><p>Executes a pull-query returning a hierarchical selection of attributes for entityId</p></div></div></div><div class="public anchor" id="var-pull-many"><h3>pull-many</h3><div class="usage"><code>(pull-many db pattern eids)</code></div><div class="doc"><div class="markdown"><p>Returns multiple hierarchical selections for the passed entity-identifiers</p></div></div></div><div class="public anchor" id="var-q"><h3>q</h3><div class="usage"><code>(q query & inputs)</code></div><div class="doc"><div class="markdown"><p><a href="https://docs.datomic.com/on-prem/clojure/index.html#datomic.api/q">Datomic Documentation</a></p></div></div></div><div class="public anchor" id="var-release"><h3>release</h3><div class="usage"><code>(release conn)</code></div><div class="doc"><div class="markdown"><p>Releases the resources associated with this <code>Connection</code>.</p>
<p>Connections are intended to be long-lived, so you should release a <code>Connection</code> only when the entire program is finished with it (for example at program shutdown).</p></div></div></div><div class="public anchor" id="var-resolve-tempid"><h3>resolve-tempid</h3><div class="usage"><code>(resolve-tempid db tempids)</code><code>(resolve-tempid db tempids tempid)</code></div><div class="doc"><div class="markdown"><p>Resolves a temporary-id to a permanent id given a database and a mapping of tempid to permids.</p>
<p>Intended for use with the results of a <a href="#var-transact"><code>transact</code></a> call:</p>
<pre><code class="clj">(let [tid (eva/tempid :db.part/user -1)
result @(eva/transact conn [[:db/add tid :db/ident :foo]])]
{:temp-id tid
:perm-id (eva/resolve-tempid (:db-after result) (:tempids result) tid)})
</code></pre>
<p>If a tempid is not passed, then a function is returned that will resolve tempids using the given db and tempids-mapping. This form should be used when resolving a collection of tempids.</p>
<pre><code class="clj">(let [t1 (eva/tempid :db.part/user -1)
t2 (eva/tempid :db.part/user -2)
t3 (eva/tempid :db.part/user -3)
result @(eva/transact conn [[:db/add t1 :db/ident :foo]
[:db/add t2 :db/ident :bar]
[:db/add t3 :db/ident :baz]])]
(map (eva/resolve-tempid (:db-after result) (:tempids result)) [t1 t2 t3]))
</code></pre></div></div></div><div class="public anchor" id="var-snapshot-t"><h3>snapshot-t</h3><div class="usage"><code>(snapshot-t db)</code></div><div class="doc"><div class="markdown"><p>Return the <code>tx-num</code> of the log entry / transaction that <code>db</code> constructed from to reflect; else <code>nil</code></p></div></div></div><div class="public anchor" id="var-squuid"><h3>squuid</h3><div class="usage"><code>(squuid)</code></div><div class="doc"><div class="markdown"><p>Constructs a semi-sequential <code>UUID</code>. Can be useful for having a unique identifier that does not fragment indexes</p></div></div></div><div class="public anchor" id="var-squuid-time-millis"><h3>squuid-time-millis</h3><div class="usage"><code>(squuid-time-millis uuid)</code></div><div class="doc"><div class="markdown"><p>Returns the time component of a <a href="#var-squuid"><code>squuid</code></a>, in the format of <code>System.currentTimeMillis</code></p></div></div></div><div class="public anchor" id="var-sync-db"><h3>sync-db</h3><div class="usage"><code>(sync-db conn)</code></div><div class="doc"><div class="markdown"><p>Like <a href="#var-db-snapshot"><code>db-snapshot</code></a>, but forces reads from the backing store to assert whether or not the in-memory database snapshot is stale before returning. If the snapshot is found to be stale, this call will block until the updated snapshot is produced from storage.</p>
<p>Communicates only with storage.</p>
<p>Intended for use when stale state on a <code>Peer</code> is suspected.</p></div></div></div><div class="public anchor" id="var-tempid"><h3>tempid</h3><div class="usage"><code>(tempid part)</code><code>(tempid part n)</code></div><div class="doc"><div class="markdown"><p>Construct a temporary id within the specified partition. Tempids will be mapped to permanent ids within a single transaction.</p>
<p>User-created tempids are reserved for values of <code>n</code> within the range of -1 to -1000000 inclusive.</p></div></div></div><div class="public anchor" id="var-to-tx-eid"><h3>to-tx-eid</h3><div class="usage"><code>(to-tx-eid tx-num-or-eid)</code></div><div class="doc"><div class="markdown"><p>Takes a <code>tx-num</code> or <code>tx-eid</code> and returns the equivalent <code>tx-eid</code></p></div></div></div><div class="public anchor" id="var-to-tx-num"><h3>to-tx-num</h3><div class="usage"><code>(to-tx-num tx-num-or-eid)</code></div><div class="doc"><div class="markdown"><p>Takes a <code>tx-num</code> or <code>tx-eid</code> and returns the equivalent <code>tx-num</code></p></div></div></div><div class="public anchor" id="var-touch"><h3>touch</h3><div class="usage"><code>(touch entity)</code></div><div class="doc"><div class="markdown"><p>Loads all attributes of the entity, recursively touching any component entities</p></div></div></div><div class="public anchor" id="var-transact"><h3>transact</h3><div class="usage"><code>(transact conn tx-data)</code></div><div class="doc"><div class="markdown"><p>Submits a transaction, blocking until a result is available.</p>
<p><code>tx-data</code> is a list of operations to be processed, including assertions, retractions, functions, or entity-maps</p>
<p>Returns a CompletableFuture which can monitor the status of the transaction. On successful commit, the future will contain a map of the following keys:</p>
<ul>
<li><code>:db-before</code> database value before transaction was applied</li>
<li><code>:db-after</code> database value after transaction was applied</li>
<li><code>:tx-data</code> collection of primitive operations performed by the transaction</li>
<li><code>:temp-ids</code> can be used with <a href="#var-resolve-tempid"><code>resolveTempId</code></a> to resolve temporary ids used in the txData</li>
</ul>
<p>If the transaction fails or timed out, attempts to .get() the future’s value will raise an <code>ExecutionException</code>. When getting the result of the future, catch <code>ExecutionException</code> and call <code>ExecutionException#getCause()</code> to retrieve the underlying error.</p></div></div></div><div class="public anchor" id="var-transact-async"><h3>transact-async</h3><div class="usage"><code>(transact-async conn tx-data)</code></div><div class="doc"><div class="markdown"><p>Like <a href="#var-transact"><code>transact</code></a> but returns immediately without waiting for the transaction to complete.</p></div></div></div><div class="public anchor" id="var-tx-range"><h3>tx-range</h3><div class="usage"><code>(tx-range log start end)</code></div><div class="doc"><div class="markdown"><p>Given a <code>Log</code> object and a start and end <code>transaction number</code> or <code>id</code>, return all applicable datoms that were asserted or retracted in the database.</p></div></div></div><div class="public anchor" id="var-with"><h3>with</h3><div class="usage"><code>(with db tx-data)</code></div><div class="doc"><div class="markdown"><p>Simulates a transaction locally without persisting the updated state. Returns a map with the same contents as the future from <a href="#var-transact"><code>transact</code></a></p></div></div></div></div></body></html>