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 index 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 index 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

inert-marked?clj

(inert-marked? kb h)

Does the record at handle h carry the :inert provenance mark assert-inert writes?

Does the record at handle `h` carry the `:inert` provenance mark `assert-inert`
writes?
sourceraw docstring

note-unsupported!clj

(note-unsupported! kb)

Find the unsupported records of kb's network and file them, ascending, under :unsupported in its :unrecovered atom, logging their count and handles at :warn when there are any. The scan reads the network and, for each node it keeps, the record's provenance; it reads no record and no index, and writes nothing to a store. Returns the handles.

Find the unsupported records of `kb`'s network and file them, ascending, under
`:unsupported` in its `:unrecovered` atom, logging their count and handles at `:warn`
when there are any.  The scan reads the network and, for each node it keeps, the
record's provenance; it reads no record and no index, and writes nothing to a store.
Returns the handles.
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.

Under kb/*trust-source?*, which open-kb binds for :recover? :trust, such an image is installed and kept (trust-installed!): no rebuild runs and writes are accepted at once.

Its settles keep the withheld-mint releases owed (special/*release-withheld?*).

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.

Under `kb/*trust-source?*`, which `open-kb` binds for `:recover? :trust`, such an image is
installed and kept (`trust-installed!`): no rebuild runs and writes are accepted at once.

Its settles keep the withheld-mint releases owed (`special/*release-withheld?*`).
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

trust-installed!clj

(trust-installed! kb image image-source ms)

Keep the image just installed into kb, written under engine source image-source other than this build's, as :recover? :trust asks: no rebuild runs, and the close-time image refresh and a seal (vaelii.impl.seal) record image-source again, read off :derived-source in (:unrecovered kb), so the image goes on naming the source its belief was last derived under in full, until a recover re-derives it under this one. The settles this KB runs move belief under this build wherever they reach. ms is the install's wall time, nil when the caller timed none.

Keep the image just installed into `kb`, written under engine source `image-source`
other than this build's, as `:recover? :trust` asks: no rebuild runs, and the close-time
image refresh and a seal (`vaelii.impl.seal`) record `image-source` again, read off
`:derived-source` in `(:unrecovered kb)`, so the image goes on naming the source its
belief was last derived under in full, until a `recover` re-derives it under this one.
The settles this KB runs move belief under this build wherever they reach.  `ms` is the
install's wall time, nil when the caller timed none.
sourceraw docstring

unsupported-handle?clj

(unsupported-handle? kb h)

Is the record at handle h stored, held by the network as a node that is no premise and that no justification concludes, and not marked :inert?

Is the record at handle `h` stored, held by the network as a node that is no premise
and that no justification concludes, and not marked `:inert`?
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