Skip to main content

Module read

Module read 

Source
Expand description

Reads (spec/surface/README.md §2): ref resolution, whole-document reads, block hydration at a resolution, the outline wire format, and the two path-ordered list surfaces. Port of packages/core/src/core/read/*. Result keys follow the reference’s spelling (docId, renderedHashMatch, …) — the fixtures are generated from it.

Structs§

BlockNode
A live block with its children (the containment forest).
DocInfo
A live document’s identity (findDoc).
DocListRow
One row of docs_list.

Enums§

Resolution
The resolution ladder.
ResolvedRef
resolve_ref’s answer.

Constants§

LIST_DEFAULT_LIMIT
docs_list / docs_tree default page size.
MANY_CAP
Max refs honored per docs_read_many / nodes_get_many call.

Functions§

block_raw
A block’s raw bytes by hex hash ("" when unknown).
docs_list
§2 docs_list: { items, truncated, cursor }.
docs_outline
§2 docs_outline: { text, truncated }.
docs_read
§2 docs_read: { path, docId, rev, properties, content } (+ ids, hashes, parents with ids); None for a missing doc.
docs_read_at
§2 docs_read_at: spec/store §6.2 plus the current properties.
docs_read_many
§2 docs_read_many: { items, errors, truncated }.
docs_tree
§2 docs_tree: { prefix, depth, total, entries, truncated, cursor }.
find_doc_by_id
A live doc by id.
find_doc_by_path
A live doc by repo + path.
find_doc_by_ref
The id-or-path dispatch every doc-ref surface routes through: a d_ id is looked up by id only (never falling through to a path).
first_words
The first n whitespace-separated words, … when cut.
load_doc_blocks
A document’s live blocks as an ordered forest (ORDER BY parent_block, order_key; a row whose parent is not live is a root).
nodes_get
§2 nodes_get: one block subtree at a resolution; None when the block is not live in doc_id.
nodes_get_many
§2 nodes_get_many: { nodes, truncated, unresolved }.
normalize_tree_prefix
Normalize a tree prefix: no leading /, and either empty or ending in /.
resolve_ref
§2 resolve_ref: an n_ node id → its live block, else its doc; a b_ id → its live block; a d_ id → the live doc; anything else → the live doc at that path; None when nothing matches.
token_cost
ceil(JSON length / 4): the token estimate every budget uses.