Liking cljdoc? Tell your friends :D

hive-datalevin.kg.recovery

Datalevin store-open self-heal. Classify an LMDB open failure and apply a recovery policy so the store returns to health without operator action. heal-and-open! composes classification + policy + the caller's open-fn; it never opens the db itself, keeping this ns driver-agnostic at compile time.

Datalevin store-open self-heal. Classify an LMDB open failure and apply a
recovery policy so the store returns to health without operator action.
`heal-and-open!` composes classification + policy + the caller's `open-fn`;
it never opens the db itself, keeping this ns driver-agnostic at compile time.
raw docstring

classify-open-failureclj

(classify-open-failure ex)

Classify a Throwable raised by an LMDB-level open. Returns one of :wal-corrupt, :lock-contention, :version-mismatch, :unknown. Walks the cause chain so a wrapping exception still classifies correctly.

Classify a Throwable raised by an LMDB-level open. Returns one of
`:wal-corrupt`, `:lock-contention`, `:version-mismatch`, `:unknown`.
Walks the cause chain so a wrapping exception still classifies correctly.
sourceraw docstring

default-policyclj

Operator-tunable default. :strategy may be a single keyword or a vector of keywords; a vector is tried left-to-right per failure until one returns :retry. :max-attempts is a positive int.

Operator-tunable default. `:strategy` may be a single keyword or a vector of
keywords; a vector is tried left-to-right per failure until one returns
`:retry`. `:max-attempts` is a positive int.
sourceraw docstring

heal-and-open!clj

(heal-and-open! {:keys [policy db-path]} open-fn)

Attempt (open-fn). On failure, classify, apply policy, retry up to :max-attempts total attempts. Returns the conn value or rethrows the last exception with :classification in its ex-data.

policy — see default-policy: :strategy keyword | [keyword ...] from #{:throw :audit :truncate :quarantine} :max-attempts positive int (default 2)

db-path is the directory open-fn opens; a policy may mutate that on-disk state before re-invoking open-fn. open-fn is a 0-arg thunk producing the conn — a thunk (not a fixed datalevin call) keeps this ns storage-agnostic.

Attempt `(open-fn)`. On failure, classify, apply policy, retry up to
`:max-attempts` total attempts. Returns the conn value or rethrows the last
exception with `:classification` in its `ex-data`.

`policy` — see `default-policy`:
  :strategy     keyword | [keyword ...] from #{:throw :audit :truncate :quarantine}
  :max-attempts positive int (default 2)

`db-path` is the directory `open-fn` opens; a policy may mutate that on-disk
state before re-invoking `open-fn`. `open-fn` is a 0-arg thunk producing the
conn — a thunk (not a fixed datalevin call) keeps this ns storage-agnostic.
sourceraw docstring

quarantine!clj

(quarantine! db-path)
(quarantine! db-path target-path)

Move the db directory aside to quarantine-path. Returns the new path on success, nil if the source doesn't exist. Throws on IO failure.

Move the db directory aside to `quarantine-path`. Returns the new path on
success, nil if the source doesn't exist. Throws on IO failure.
sourceraw docstring

quarantine-pathclj

(quarantine-path db-path)
(quarantine-path db-path ts)

Derive the quarantine path for db-path. Deterministic given a timestamp; defaults to System/currentTimeMillis for live calls.

Derive the quarantine path for `db-path`. Deterministic given a timestamp;
defaults to `System/currentTimeMillis` for live calls.
sourceraw docstring

truncate-tail!clj

(truncate-tail! db-path)
(truncate-tail! db-path ts)

Walk the txn-log segment directory under db-path. For each segment whose strict scan fails but lenient scan reports :partial-tail? true, copy it aside and invoke datalevin's truncate-partial-tail!. Returns a vec of per-segment heal records; empty means no segment needed truncation.

Walk the txn-log segment directory under `db-path`. For each segment whose
strict scan fails but lenient scan reports `:partial-tail? true`, copy it
aside and invoke datalevin's `truncate-partial-tail!`. Returns a vec of
per-segment heal records; empty means no segment needed truncation.
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