Liking cljdoc? Tell your friends :D

vaelii.impl.recovery

Build the in-memory JTMS and taxonomy for the persistent stores — the store-to-belief recover, which installs a reasoning image (vaelii.impl.reasoning-image) or rebuilds from the records and writes one.

It sits just below vaelii.core, above settle, so the two callers that recover a store both reach it downward and neither reaches up: vaelii.core exposes it as the public recover, and vaelii.impl.io.import recovers the records a dump just landed (docs/namespaces.md, "The layering"). recover orchestrates the layers below — rebuild-tms over the JTMS, special/rebuild-taxonomy, the roster rebuilds in kb, and the closing settle — so the top of that orchestration lives here rather than inside any one of them. The contract recover holds to is on vaelii.core/recover; docs/taxonomy.md and docs/nmtms.md carry the mechanism.

Build the in-memory JTMS and taxonomy for the persistent stores — the store-to-belief
`recover`, which installs a reasoning image (`vaelii.impl.reasoning-image`) or rebuilds from
the records and writes one.

It sits just below `vaelii.core`, above `settle`, so the two callers that recover a store
both reach it downward and neither reaches up: `vaelii.core` exposes it as the public
`recover`, and `vaelii.impl.io.import` recovers the records a dump just landed
(docs/namespaces.md, "The layering").  `recover` orchestrates the layers below —
`rebuild-tms` over the JTMS, `special/rebuild-taxonomy`, the roster rebuilds in `kb`, and
the closing `settle` — so the top of that orchestration lives here rather than inside any
one of them.  The contract `recover` holds to is on `vaelii.core/recover`; docs/taxonomy.md
and docs/nmtms.md carry the mechanism.
raw docstring

*before-install*clj

A function of the rebuilt KB, called on the rebuild thread before the rebuilt belief replaces the installed image's, or nil. Nil everywhere but a test, which binds it around open-kb to hold the rebuild while it reads the KB the image answers for.

A function of the rebuilt KB, called on the rebuild thread before the rebuilt belief
replaces the installed image's, or nil.  Nil everywhere but a test, which binds it
around `open-kb` to hold the rebuild while it reads the KB the image answers for.
sourceraw docstring

abandoning?clj

(abandoning?)

Has the belief rebuild running on this thread been asked to stop? False outside a rebuild. A *before-install* function reads it.

Has the belief rebuild running on this thread been asked to stop?  False outside a
rebuild.  A `*before-install*` function reads it.
sourceraw docstring

rebuild-progressclj

(rebuild-progress kb)

Where the belief rebuild behind kb's installed image has got to, or nil when none runs. A rebuild that threw is reported until a recover replaces it, with :failed added and its clock stopped at the throw.

:step :of :key :label the step running now, 1-based, of rebuild-steps; step 0 is the moment between the open and the first step. After a throw, the step the rebuild was in :failed after a throw: {:at :class :message}, when (epoch ms), the exception's class name, and its message :started-at :elapsed-ms when the rebuild began (epoch ms), and how long ago, or how long it ran before the throw :image the installed image's :source digest, its :written-at, and its :recover, the step timings of the recover it was written after, when the image records them :source the running build's source digest :expected-ms :fraction from the image's :recover, when present: that recover's total, and the share of it the steps done so far took there

Where the belief rebuild behind `kb`'s installed image has got to, or nil when none runs.
A rebuild that threw is reported until a `recover` replaces it, with `:failed` added and
its clock stopped at the throw.

  :step :of :key :label    the step running now, 1-based, of `rebuild-steps`; step 0 is
                           the moment between the open and the first step.  After a
                           throw, the step the rebuild was in
  :failed                  after a throw: `{:at :class :message}`, when (epoch ms), the
                           exception's class name, and its message
  :started-at :elapsed-ms  when the rebuild began (epoch ms), and how long ago, or how
                           long it ran before the throw
  :image                   the installed image's `:source` digest, its `:written-at`, and
                           its `:recover`, the step timings of the recover it was written
                           after, when the image records them
  :source                  the running build's source digest
  :expected-ms :fraction   from the image's `:recover`, when present: that recover's
                           total, and the share of it the steps done so far took there
sourceraw docstring

recoverclj

(recover kb)

The implementation of vaelii.core/recover — build the in-memory JTMS and taxonomy for the persistent stores. The public contract, and when a caller runs it, are on vaelii.core/recover; the mechanism is here, in vaelii.impl.reasoning-image and in docs/taxonomy.md.

A :disk-snapshot KB whose reasoning image still describes its records, its source and its policies installs the image and recovers nothing (reasoning-image/install!). Every other KB, and that one whenever the image is declined, recovers from the records (recover-from-records) and then writes an image for the next open (reasoning-image/save!, a no-op for a KB that takes none). Both paths register the close-time refresh (reasoning-image/register-close!).

Under kb/*background-belief?*, which open-kb binds for :recover? :background, an image declined only for its engine source is installed anyway, and start-rebuild! rebuilds belief under this build behind it. A call while such a rebuild runs stops the rebuild and runs it on the calling thread instead.

The implementation of `vaelii.core/recover` — build the in-memory JTMS and taxonomy for
the persistent stores.  The public contract, and when a caller runs it, are on
`vaelii.core/recover`; the mechanism is here, in `vaelii.impl.reasoning-image` and in
docs/taxonomy.md.

A `:disk-snapshot` KB whose reasoning image still describes its records, its source and
its policies installs the image and recovers nothing (`reasoning-image/install!`).  Every
other KB, and that one whenever the image is declined, recovers from the records
(`recover-from-records`) and then writes an image for the next open
(`reasoning-image/save!`, a no-op for a KB that takes none).  Both paths register the
close-time refresh (`reasoning-image/register-close!`).

Under `kb/*background-belief?*`, which `open-kb` binds for `:recover? :background`, an
image declined only for its engine source is installed anyway, and `start-rebuild!`
rebuilds belief under this build behind it.  A call while such a rebuild runs stops the
rebuild and runs it on the calling thread instead.
sourceraw docstring

recover-with-imageclj

(recover-with-image kb dir records)

recover, trying the reasoning image in dir first — an export dump's, which vaelii.impl.io.import lands the records of. records is the content fingerprint of the records the import landed, {:sentexes fp :justifications fp}, in the form the dump's manifest carries. Returns {:reasoning :installed} or {:reasoning :recovered :reason r}, r the reason reasoning-image/install-from! gave for declining the image.

`recover`, trying the reasoning image in `dir` first — an export dump's, which
`vaelii.impl.io.import` lands the records of.  `records` is the content fingerprint of
the records the import landed, `{:sentexes fp :justifications fp}`, in the form the
dump's manifest carries.  Returns `{:reasoning :installed}` or `{:reasoning :recovered
:reason r}`, `r` the reason `reasoning-image/install-from!` gave for declining the image.
sourceraw docstring

register-fresh-store!clj

(register-fresh-store! kb)

Register the reasoning image's close-time save for kb when it opened over an empty store, and return kb. Such a KB builds its belief assert by assert and never runs recover, so without this its first image would wait for the next open's recover. A KB opened over a populated store registers inside recover instead, and one opened with :recover? false over a populated store registers nowhere: it holds no belief to write. reasoning-image/save! refuses a KB whose network does not cover its records, so a loader that fills this KB and skips the recover leaves nothing to write.

Register the reasoning image's close-time save for `kb` when it opened over an empty
store, and return `kb`.  Such a KB builds its belief assert by assert and never runs
`recover`, so without this its first image would wait for the next open's recover.  A
KB opened over a populated store registers inside `recover` instead, and one opened
with `:recover? false` over a populated store registers nowhere: it holds no belief to
write.  `reasoning-image/save!` refuses a KB whose network does not cover its records, so
a loader that fills this KB and skips the recover leaves nothing to write.
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