Liking cljdoc? Tell your friends :D

syncopate.store

The ragtime DataStore half of Syncopate.

Applied-migration state lives in a dedicated key-value DBI on the same LMDB environment the app's Datalog connection already holds open — never as datoms. This keeps migration bookkeeping out of the application's schema and query space (it stays invisible to d/schema and Datalog queries) and works under :closed-schema? true.

Why reach into the connection instead of opening our own KV handle: Datalevin forbids two LMDB connections to the same directory in one process — open-kv on a directory an open Datalog conn owns throws. The supported path for an embedded library is to reuse the connection's own environment, obtained via the backing Store's lmdb handle.

The ragtime DataStore half of Syncopate.

Applied-migration state lives in a dedicated key-value DBI on the *same*
LMDB environment the app's Datalog connection already holds open — never as
datoms. This keeps migration bookkeeping out of the application's schema and
query space (it stays invisible to `d/schema` and Datalog queries) and works
under `:closed-schema? true`.

Why reach into the connection instead of opening our own KV handle: Datalevin
forbids two LMDB connections to the same directory in one process — `open-kv`
on a directory an open Datalog conn owns throws. The supported path for an
embedded library is to reuse the connection's own environment, obtained via
the backing Store's `lmdb` handle.
raw docstring

conn->lmdbclj

(conn->lmdb conn)

The KV/LMDB handle backing a live 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 a live 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`.
sourceraw docstring

default-dbi-nameclj

source

ensure-store!clj

(ensure-store! conn dbi-name)

Open (creating if absent) the migrations DBI on conn's environment. Idempotent — our equivalent of the SQL adaptors' ensure-migrations-table-exists. Must be called on the base connection before entering with-transaction (opening a DBI inside a write transaction is unsafe).

Open (creating if absent) the migrations DBI on `conn`'s environment.
Idempotent — our equivalent of the SQL adaptors' `ensure-migrations-table-exists`.
Must be called on the base connection *before* entering `with-transaction`
(opening a DBI inside a write transaction is unsafe).
sourceraw docstring

next-seqclj

(next-seq conn dbi-name)

The next monotonic application sequence number for conn's migrations DBI: 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 `conn`'s migrations DBI:
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.
sourceraw docstring

record!clj

(record! conn dbi-name id seq)

Record id as applied with application sequence seq, via conn (which may be transaction-bound). Assumes the DBI already exists (see ensure-store!).

Record `id` as applied with application sequence `seq`, via `conn` (which may be
transaction-bound). Assumes the DBI already exists (see `ensure-store!`).
sourceraw docstring

storeclj

(store conn)
(store conn {:keys [dbi-name] :or {dbi-name default-dbi-name}})

Construct a Syncopate DataStore over a live Datalevin Datalog connection.

Options: :dbi-name - name of the KV DBI holding applied-migration state (default "__syncopate_migrations").

Construct a Syncopate DataStore over a live Datalevin Datalog connection.

Options:
  :dbi-name - name of the KV DBI holding applied-migration state
              (default "__syncopate_migrations").
sourceraw docstring

unrecord!clj

(unrecord! conn dbi-name id)

Remove id from the applied set, via conn (which may be transaction-bound).

Remove `id` from the applied set, via `conn` (which may be transaction-bound).
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close