Entity ids: one positive long packing a partition, a block, and an index. Partition 0 holds the bootstrap schema (attributes and their enums), partition 1 holds transacted entities, partition 2 holds transaction entities, which pack t into the payload bits.
This namespace is a pure-arithmetic leaf: it requires nothing and never sees a db value. Callers own the allocation counter — kala.tx keeps ::core/next-idx in the db value and advances it through alloc-user-eid, and replay restores that counter with user-alloc-index. tx entity ids are monotonic in t: kala.time-travel's since compares them as packed longs and relies on it.
Entity ids: one positive long packing a partition, a block, and an index. Partition 0 holds the bootstrap schema (attributes and their enums), partition 1 holds transacted entities, partition 2 holds transaction entities, which pack t into the payload bits. This namespace is a pure-arithmetic leaf: it requires nothing and never sees a db value. Callers own the allocation counter — kala.tx keeps ::core/next-idx in the db value and advances it through alloc-user-eid, and replay restores that counter with user-alloc-index. tx entity ids are monotonic in t: kala.time-travel's since compares them as packed longs and relies on it.
(alloc-user-eid n)The user entity id of allocation counter n: block (quot n block-count), index (rem n block-count). Total and injective in n.
The user entity id of allocation counter n: block (quot n block-count), index (rem n block-count). Total and injective in n.
(bootstrap-eid idx)The entity id of bootstrap-schema placement idx: block 0 of partition 0.
The entity id of bootstrap-schema placement idx: block 0 of partition 0.
(bootstrap-eid? x)Is x a partition-0 (bootstrap schema) entity id?
Is x a partition-0 (bootstrap schema) entity id?
(eid->t e)Extract the transaction counter from a tx entity id.
Extract the transaction counter from a tx entity id.
(tx-eid t)The transaction entity id of t. Monotonic in t — the since view compares tx entity ids as packed longs and relies on it.
The transaction entity id of t. Monotonic in t — the since view compares tx entity ids as packed longs and relies on it.
(tx-eid? x)Is x a partition-2 (transaction entity) id?
Is x a partition-2 (transaction entity) id?
(user-alloc-index x)The allocation counter one past user entity id x — the inverse of alloc-user-eid — or nil if x is not a user entity id. Replay restores ::core/next-idx by taking the max of this over every datom's entity slot.
The allocation counter one past user entity id x — the inverse of alloc-user-eid — or nil if x is not a user entity id. Replay restores ::core/next-idx by taking the max of this over every datom's entity slot.
(user-eid? x)Is x a partition-1 (transacted entity) id?
Is x a partition-1 (transacted entity) id?
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |