The ragtime DataStore half of Syncopate.
Applied-migration state lives in a dedicated key-value DBI on the same environment the app's Datalog connection already holds — never as datoms. This holds for both connection kinds:
datalevin.storage.Store's lmdb handle (Datalevin forbids a
second LMDB connection to the same directory in one process, so we can't just
open-kv).dtlv:// URI): the remote Datalog store does not expose
the KV surface, so open a KV client to the SAME server database via
open-kv. It shares the datalog connection's server environment (its DBIs sit
alongside datalevin/eav etc.), so the promise holds — a KV DBI on the same
env, never datoms. (Because that KV client is a separate session, it can't join
the datalog with-transaction, so client/server migrations record with the
two-transaction seam rather than the single-transaction fold.)The ragtime DataStore half of Syncopate. Applied-migration state lives in a dedicated key-value DBI on the *same* environment the app's Datalog connection already holds — never as datoms. This holds for both connection kinds: - **embedded** (a local LMDB directory): reuse the connection's own environment via the backing `datalevin.storage.Store`'s `lmdb` handle (Datalevin forbids a second LMDB connection to the same directory in one process, so we can't just `open-kv`). - **client/server** (a `dtlv://` URI): the remote Datalog store does not expose the KV surface, so open a KV *client* to the SAME server database via `open-kv`. It shares the datalog connection's server environment (its DBIs sit alongside `datalevin/eav` etc.), so the promise holds — a KV DBI on the same env, never datoms. (Because that KV client is a separate session, it can't join the datalog `with-transaction`, so client/server migrations record with the two-transaction seam rather than the single-transaction fold.)
(close! store)Release resources the store holds beyond its conn. For a client/server store
this closes the KV client opened to the server; embedded stores hold the
connection's own env, so it's a no-op (the caller closes the connection).
Release resources the store holds beyond its `conn`. For a client/server store this closes the KV client opened to the server; embedded stores hold the connection's own env, so it's a no-op (the caller closes the connection).
(conn->lmdb conn)The KV/LMDB handle backing an embedded Datalog connection. Works for a
transaction-bound connection too, so the atomic helpers in syncopate.core can
write the applied-id inside the migration's own with-transaction.
The KV/LMDB handle backing an *embedded* Datalog connection. Works for a transaction-bound connection too, so the atomic helpers in `syncopate.core` can write the applied-id inside the migration's own `with-transaction`.
(ensure-store! lmdb dbi-name)Open (creating if absent) the migrations DBI on lmdb. Idempotent — our
equivalent of the SQL adaptors' ensure-migrations-table-exists.
Open (creating if absent) the migrations DBI on `lmdb`. Idempotent — our equivalent of the SQL adaptors' `ensure-migrations-table-exists`.
(next-seq lmdb dbi-name)The next monotonic application sequence number for the migrations DBI on lmdb:
one past the largest :seq on record (never reused, so it's robust to the gaps
unrecord! leaves). Ordering by :seq reflects true application order, immune to
wall-clock millisecond ties.
The next monotonic application sequence number for the migrations DBI on `lmdb`: one past the largest `:seq` on record (never reused, so it's robust to the gaps `unrecord!` leaves). Ordering by `:seq` reflects true application order, immune to wall-clock millisecond ties.
(record! lmdb dbi-name id seq)Record id as applied with application sequence seq on lmdb (which may be a
transaction-bound handle). Assumes the DBI already exists (see ensure-store!).
Record `id` as applied with application sequence `seq` on `lmdb` (which may be a transaction-bound handle). Assumes the DBI already exists (see `ensure-store!`).
(store conn)(store conn {:keys [dbi-name] :or {dbi-name default-dbi-name}})Construct a Syncopate DataStore over a live Datalevin connection — embedded or
client/server (dtlv://). For a client/server connection this opens a KV client
to the same server database; release it with close! when done.
Options: :dbi-name - name of the KV DBI holding applied-migration state (default "__syncopate_migrations").
Construct a Syncopate DataStore over a live Datalevin connection — embedded or
client/server (`dtlv://`). For a client/server connection this opens a KV client
to the same server database; release it with `close!` when done.
Options:
:dbi-name - name of the KV DBI holding applied-migration state
(default "__syncopate_migrations").(unrecord! lmdb dbi-name id)Remove id from the applied set on lmdb (which may be transaction-bound).
Remove `id` from the applied set on `lmdb` (which may be transaction-bound).
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 |