Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.persistance

Persistence facade: backend registry, connection lifecycle, and every delegated store-*/db-* fn.

Extensions register backend adapters through :ext/persistance. The facade dispatches each delegated call by resolving the matching var on the chosen backend namespace ((ns-resolve ns-sym 'db-store-iteration!) etc.) and applying it to the original args. This keeps the facade dialect-agnostic - every migration runner / driver-specific oddity stays inside the backend adapter.

Frontends still call db-error->user-message here, but the actual translation is offered by backend adapters. Same for store-staleness checks used by the process-wide shared connection.

Persistence facade: backend registry, connection lifecycle, and every
delegated `store-*`/`db-*` fn.

Extensions register backend adapters through `:ext/persistance`. The
facade dispatches each delegated call by resolving the matching var on
the chosen backend namespace (`(ns-resolve ns-sym 'db-store-iteration!)`
etc.) and applying it to the original args. This keeps the facade
dialect-agnostic - every migration runner / driver-specific oddity stays
inside the backend adapter.

Frontends still call `db-error->user-message` here, but the actual
translation is offered by backend adapters. Same for store-staleness
checks used by the process-wide shared connection.
raw docstring

->dateclj

(->date v)
source

->epoch-msclj

(->epoch-ms v)
source

->idclj

(->id v)
source

->kwclj

(->kw v)

Keyword/string -> TEXT, stripping the leading colon. Nil -> nil.

Keyword/string -> TEXT, stripping the leading colon. Nil -> nil.
sourceraw docstring

->kw-backclj

(->kw-back v)
source

->refclj

(->ref v)

Normalize an entity reference to a string ID for SQL. Accepts: UUID, string, or nil. Returns string or nil.

The ONLY way to extract a SQL-ready string from an entity reference -- pass the plain UUID or string directly.

Normalize an entity reference to a string ID for SQL.
Accepts: UUID, string, or nil. Returns string or nil.

The ONLY way to extract a SQL-ready string from an entity
reference -- pass the plain UUID or string directly.
sourceraw docstring

->uuidclj

(->uuid v)
source

db-create-connection!clj

(db-create-connection! db-spec)

Open a persistence connection from db-spec.

Common spec forms: nil - no DB (returns nil) :memory - in-memory ephemeral store (backend-defined) "path/to.db" - file-backed store (backend-defined) {:backend :sqlite :path ...} - explicit backend selection {:backend :sqlite :datasource ds} - caller-owned DataSource

With a single registered backend, omitting :backend works and the facade tags the returned store map with the chosen backend so all subsequent facade calls dispatch correctly.

Triggers manifest/scan-extensions! on first call so a freshly started JVM with no extensions yet required has a chance to load any backend-providing namespaces from the classpath.

Open a persistence connection from `db-spec`.

Common spec forms:
  nil              - no DB (returns nil)
  :memory          - in-memory ephemeral store (backend-defined)
  "path/to.db"   - file-backed store (backend-defined)
  {:backend :sqlite :path ...}     - explicit backend selection
  {:backend :sqlite :datasource ds} - caller-owned DataSource

With a single registered backend, omitting `:backend` works and the
facade tags the returned store map with the chosen backend so all
subsequent facade calls dispatch correctly.

Triggers `manifest/scan-extensions!` on first call so a freshly
started JVM with no extensions yet required has a chance to load
any backend-providing namespaces from the classpath.
sourceraw docstring

db-create-extension-aggregate!clj

(db-create-extension-aggregate! db-info opts)
source

db-delete-extension-aggregates!clj

(db-delete-extension-aggregates! db-info opts)
source

db-delete-session-tree!clj

(db-delete-session-tree! db-info id)
source

db-dispose-connection!clj

(db-dispose-connection! store)
source

db-dispose-shared-connection!clj

(db-dispose-shared-connection!)

Close the shared connection if one is open. Idempotent.

Close the shared connection if one is open. Idempotent.
sourceraw docstring

db-error->user-messageclj

(db-error->user-message e)

Translate a persistence exception into something a human can act on. Backend adapters own backend-specific recognition; unknown errors fall back to (ex-message e).

Translate a persistence exception into something a human can act on.
Backend adapters own backend-specific recognition; unknown errors fall
back to `(ex-message e)`.
sourceraw docstring

db-find-session-by-externalclj

(db-find-session-by-external db-info channel ext-id)
source

db-fork-session!clj

(db-fork-session! db-info session-id opts)
source

db-get-extension-aggregateclj

(db-get-extension-aggregate db-info opts)
source

db-get-sessionclj

(db-get-session db-info ref)
source

db-get-session-model-prefclj

(db-get-session-model-pref db-info session-id)
source

db-latest-session-state-idclj

(db-latest-session-state-id db-info session-id)
source

db-list-extension-aggregatesclj

(db-list-extension-aggregates db-info opts)
source

db-list-iteration-attachmentsclj

(db-list-iteration-attachments db-info iteration-id)
source

db-list-iterations-attachmentsclj

(db-list-iterations-attachments db-info iteration-ids)
source

db-list-session-attachmentsclj

(db-list-session-attachments db-info session-id)
source

db-list-session-statesclj

(db-list-session-states db-info session-id)
source

db-list-session-turn-iterationsclj

(db-list-session-turn-iterations db-info session-turn-ref)
source

db-list-session-turn-statesclj

(db-list-session-turn-states db-info session-turn-id)
source

db-list-session-turnsclj

(db-list-session-turns db-info session-ref)
source

db-list-session-turns-by-statusclj

(db-list-session-turns-by-status db-info status)
source

db-list-sessionsclj

(db-list-sessions db-info channel)
source

db-list-turn-all-attachmentsclj

(db-list-turn-all-attachments db-info session-turn-soul-id)
source

db-list-turn-attachmentsclj

(db-list-turn-attachments db-info session-turn-soul-id)
source

db-list-turns-attachmentsclj

(db-list-turns-attachments db-info session-turn-soul-ids)
source

db-load-ctx-historyclj

(db-load-ctx-history db-info session-id)
source

db-load-latest-ctxclj

(db-load-latest-ctx db-info session-id)
source

db-log!clj

(db-log! db-info opts)
source

db-native-results-for-tool-idsclj

(db-native-results-for-tool-ids db-info session-id tool-ids)
source

db-put-extension-aggregate!clj

(db-put-extension-aggregate! db-info opts)
source

db-read-attachmentclj

(db-read-attachment db-info attachment-id)
source

db-repo-focus-getclj

(db-repo-focus-get db-info repo-id)
source

db-repo-focus-set!clj

(db-repo-focus-set! db-info repo-id workspace-id)
source

db-resolve-session-idclj

(db-resolve-session-id db-info sel)
source

db-retry-session-turn!clj

(db-retry-session-turn! db-info session-turn-soul-id opts)
source

(db-search db-info query opts)

Backend-neutral full-text search facade. Delegates to the registered persistence backend, which RENDERS the neutral query DSL into its native full-text query and runs it. No caller passes an engine dialect — only the DSL in search-query-dsl-doc.

query is the DSL — a string (implicit-AND of its words) or a DSL map. opts: :owner-table restrict to one owner table (string) :field restrict to one indexed field (string) :limit max hits (backend default applies when nil)

Returns a vector of hits sorted by relevance (best first), each {:owner-table :owner-id :field :snippet :rank}. Backends MUST honor the DSL; an engine that cannot express a node should degrade it (e.g. :near -> :all), never reject well-formed DSL. A MALFORMED query (e.g. a lone :not) may throw — that is a DSL logic error, distinct from un-matchable content.

Backend-neutral full-text search facade. Delegates to the registered
persistence backend, which RENDERS the neutral query DSL into its native
full-text query and runs it. No caller passes an engine dialect — only the
DSL in `search-query-dsl-doc`.

`query` is the DSL — a string (implicit-AND of its words) or a DSL map.
`opts`:
  :owner-table  restrict to one owner table (string)
  :field        restrict to one indexed field (string)
  :limit        max hits (backend default applies when nil)

Returns a vector of hits sorted by relevance (best first), each
`{:owner-table :owner-id :field :snippet :rank}`. Backends MUST honor the
DSL; an engine that cannot express a node should degrade it (e.g. :near ->
:all), never reject well-formed DSL. A MALFORMED query (e.g. a lone :not)
may throw — that is a DSL logic error, distinct from un-matchable content.
sourceraw docstring

db-session-state-list-for-workspaceclj

(db-session-state-list-for-workspace db-info workspace-id)
source

db-session-state-set-workspace!clj

(db-session-state-set-workspace! db-info session-state-id workspace-id)
source

db-set-session-model-pref!clj

(db-set-session-model-pref! db-info session-id provider model)
source

db-shared-connection!clj

(db-shared-connection! db-spec)

Return the process-wide shared persistence connection for db-spec, opening it on first call and caching the handle for the lifetime of the JVM. Subsequent calls return the cached handle regardless of the db-spec argument - the singleton intentionally pins to the first spec it saw.

Pair with db-dispose-shared-connection! on process shutdown.

Return the process-wide shared persistence connection for `db-spec`,
 opening it on first call and caching the handle for the lifetime of
 the JVM. Subsequent calls return the cached handle regardless of
 the `db-spec` argument - the singleton intentionally pins to the
 first spec it saw.

Pair with `db-dispose-shared-connection!` on process shutdown.
sourceraw docstring

db-store-iteration!clj

(db-store-iteration! db-info opts)

Same delegating shape as the macro-defined fns, but with input validation kept here so every backend gets the same precondition guarantees for free.

Same delegating shape as the macro-defined fns, but with input
validation kept here so every backend gets the same precondition
guarantees for free.
sourceraw docstring

db-store-session!clj

(db-store-session! db-info opts)
source

db-store-session-turn!clj

(db-store-session-turn! db-info opts)
source

db-swap-extension-aggregate!clj

(db-swap-extension-aggregate! db-info opts f args)
source

db-turn-historyclj

(db-turn-history db-info session-ref)
source

db-update-session-title!clj

(db-update-session-title! db-info ref title)
source

db-update-session-turn!clj

(db-update-session-turn! db-info session-turn-id opts)
source

db-workspace-for-sessionclj

(db-workspace-for-session db-info session-state-id)
source

db-workspace-getclj

(db-workspace-get db-info workspace-id)
source

db-workspace-insert!clj

(db-workspace-insert! db-info opts)
source

db-workspace-list-by-repoclj

(db-workspace-list-by-repo db-info repo-id)
(db-workspace-list-by-repo db-info repo-id state-set)
source

db-workspace-set-filesystem-roots!clj

(db-workspace-set-filesystem-roots! db-info workspace-id roots)
source

db-workspace-touch-focus!clj

(db-workspace-touch-focus! db-info workspace-id)
source

db-workspace-update-label!clj

(db-workspace-update-label! db-info workspace-id label)
source

db-workspace-update-state!clj

(db-workspace-update-state! db-info workspace-id new-state)
source

deregister-backend!clj

(deregister-backend! id)
source

dsclj

(ds db-info)
source

now-msclj

(now-ms)
source

register-backend!clj

(register-backend! id ns-sym)

Register a persistence backend implementation.

id - keyword identity, e.g. :sqlite. ns-sym - fully qualified namespace symbol that defines the backend functions (db-open!, db-close!, db-log!, every store-*/db-* fn used by this facade). Vars are resolved lazily via ns-resolve so REPL redefinition just works.

Idempotent on id. Returns id.

Register a persistence backend implementation.

`id`     - keyword identity, e.g. `:sqlite`.
`ns-sym` - fully qualified namespace symbol that defines the backend
           functions (`db-open!`, `db-close!`, `db-log!`, every
           `store-*`/`db-*` fn used by this facade). Vars are
           resolved lazily via `ns-resolve` so REPL redefinition
           just works.

Idempotent on `id`. Returns `id`.
sourceraw docstring

registered-backendsclj

(registered-backends)

Map of registered backends keyed by id.

Map of registered backends keyed by id.
sourceraw docstring

search-query-dsl-docclj

source

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