Expand description
The documentation model of lean-ctx.
A page is a title and an ordered list of sections; notes are addenda that
never touch the body; anchors bind a page to the code it describes, so a
change to that code turns the page stale. Everything here is pure: the
engine reads and writes the replica through its own adapter, and LeanCTX |
Hive replicates the pages as place nodes (page, section, note).
Re-exports§
pub use anchor::Anchor;pub use anchor::AnchorKind;pub use anchor::AnchorMode;pub use anchor::AnchorRole;pub use anchor::AnchorState;pub use anchor::Coverage;pub use model::Note;pub use model::Page;pub use model::PageStatus;pub use model::Section;
Modules§
- anchor
- Code anchors: what a page derives from, pinned at a content digest.
- emspace
- Reading an emspace export into pages, for the move of a space to Hive.
- fold
- Lowest-seq membership of doc nodes (C0 2.2, shared with Hive’s
hive-docs): a section’s page is thetoof its livepart_ofedge with the lowest seq; a note’s subject thetoof its liveaboutedge with the lowest seq; a slug belongs to the live page with the lowestnode.addseq that holds it now, and every other live page holding it is in conflict. - links
- Links inside page bodies:
[Title](/slug#frag)to another page and[Title](emspace:tasks/<id>)-style references to other objects. Code fences and inline code spans are never touched. - local
- A project’s docs without Hive: an append-only journal of the same C0 2.2
doc events a vault holds (
node.add,field.set,edge.add,retract), folded withcrate::replica::assemble, so a local page reads exactly like a vault page. - model
- Pages, sections and notes.
- replica
- Pages assembled from a place log (C0 2.2): the engine hands over its verified events, in any order, and reads pages, sections, notes, each node’s head event (the base of a CAS write) and the derived doc state.
- sections
- Splitting a markdown body into sections and joining it back.
- state
- The derived doc state of a page (C0 2.2
doc-states), never stored: fresh, noted (every derived anchor that moved is covered by an open note that accounted for exactly what is observed now) or stale. - write
- Doc writes as unsigned place events (C0 2.2). The engine fills in the
envelope (event id, nonce, commit, HLC, signature) and queues them in
order; CAS-checked
field.sets carry the head they were built on, so a batch can chain edits: each event’s base is the one before it.
Constants§
- MAX_
DOC_ BODY_ BYTES - C0 2.2: the canonical JSON of a doc node’s plaintext body is at most this many bytes, so it still fits a 32 KiB event once sealed.
- ORDER_
GAP - The distance between the
orderof two adjacent sections when a page is laid out fresh, so an insert between them rarely forces a renumbering. - SECTION_
MAX_ BYTES - The largest section text the splitter produces, in bytes of Markdown. It
leaves room for JSON escaping under
MAX_DOC_BODY_BYTES.