Skip to main content

Module okfscript

Module okfscript 

Source
Expand description

The ct-okf --script engine: a batch of OKF mutations applied under the prepare/confirm/write standard.

A .ctb block document (parsed by crate::blockdoc) lists new/set/ log/index/init items. simulate runs the whole batch in memory over a [Vfs] overlay — in script order, under cascade, so a later index sees a concept an earlier new created and a later set edits an earlier one — and returns the complete set of pending writes. The caller writes them only when every op succeeded; any failing op aborts the batch with nothing written.

The overlay reads through a Disk for files it has not (yet) written, so the engine is pure with respect to a supplied disk and can be unit-tested against an in-memory one.

Structs§

Action
One simulated write or no-op, for reporting.
FsDisk
A real filesystem Disk.
OpSpec
One script op with its source position.
Plan
The fully-simulated batch: per-op actions and the pending writes (each path relative to the engine base, paired with its final content).

Enums§

OkfOp
One compiled okf mutation.

Constants§

ITEM_NAMES
The directives that open an item in an okf script.

Traits§

Disk
The read surface the [Vfs] overlays writes on top of.

Functions§

compile
Compile parsed Items into OpSpecs, validating each.
simulate
Simulate the whole batch over disk, rooted at base, stamping today into new concepts and log entries. Returns the plan (actions + pending writes), or the first op’s error — in which case the caller writes nothing.