Module graph_ledger

Module graph_ledger 

Source
Expand description

System-block graph compiler and append-only 100-node chunk ledger.

Translates the Document Character and Format CSV database into immutable 3-token statement triples, seed classification entities, and deduplicated value nodes in the System block (8589934592..=12884901887), persisted as 100-node chunk files in assets/data/graph/85899_34592.ctbnodes, etc.

Re-exports§

pub use crate::ctbnbdl::CREATED_NS_COMMENT_PREFIX;
pub use crate::ctbnbdl::CTBNBDL_MAGIC;
pub use crate::ctbnbdl::CtbnbdlFramingDcs;
pub use crate::ctbnbdl::DC_SYSTEM_BLOCK_MOST_RECENT_NODE_ID;
pub use crate::ctbnbdl::DCMM_HEADER;
pub use crate::ctbnbdl::DurableTransactionOutcome;
pub use crate::ctbnbdl::FaultInjectionPoint;
pub use crate::ctbnbdl::LEDGER_JOURNAL_REL_PATH;
pub use crate::ctbnbdl::LedgerNode;
pub use crate::ctbnbdl::LedgerReadGuard;
pub use crate::ctbnbdl::MAX_BYTES_PER_BUNDLE;
pub use crate::ctbnbdl::MAX_NODES_PER_BUNDLE;
pub use crate::ctbnbdl::MAX_NODES_PER_CHUNK;
pub use crate::ctbnbdl::PlannedLedgerItem;
pub use crate::ctbnbdl::TransactionManifest;
pub use crate::ctbnbdl::chunk_filename_for_node_id;
pub use crate::ctbnbdl::compile_ctbnodes_dir_to_ctbnbdl;
pub use crate::ctbnbdl::compile_ctbnodes_dir_to_ctbnbdl_with_limits;
pub use crate::ctbnbdl::compile_ctbnodes_file_to_ctbnbdl_bytes;
pub use crate::ctbnbdl::compile_inactive_ctbnodes_dir_to_ctbnbdl;
pub use crate::ctbnbdl::compile_inactive_ctbnodes_dir_to_ctbnbdl_with_limits;
pub use crate::ctbnbdl::compute_nodes_slice_ledger_sha256;
pub use crate::ctbnbdl::consume_atom_dc_with;
pub use crate::ctbnbdl::current_unix_timestamp_ns;
pub use crate::ctbnbdl::decode_ctbnbdl_bundle_resilient_with;
pub use crate::ctbnbdl::decode_ctbnbdl_bundle_with;
pub use crate::ctbnbdl::decode_nodes_from_ctbnbdl_bytes_with;
pub use crate::ctbnbdl::encode_for_each_statement_tokens_with;
pub use crate::ctbnbdl::encode_node_definition_dcmm2_bytes_with;
pub use crate::ctbnbdl::encode_node_definition_tokens_with;
pub use crate::ctbnbdl::encode_nodes_to_ctbnbdl_bundles_with_limits;
pub use crate::ctbnbdl::encode_nodes_to_ctbnbdl_bundles_with_limits_and_most_recent;
pub use crate::ctbnbdl::encode_nodes_to_ctbnbdl_bytes_with;
pub use crate::ctbnbdl::ensure_ledger_journal_clean;
pub use crate::ctbnbdl::execute_durable_ledger_transaction_with_planner;
pub use crate::ctbnbdl::format_chunk_bundle_filename;
pub use crate::ctbnbdl::format_chunk_filename;
pub use crate::ctbnbdl::inspect_ledger_journal;
pub use crate::ctbnbdl::is_relationship_verb_with;
pub use crate::ctbnbdl::list_chunk_files;
pub use crate::ctbnbdl::load_ledger_nodes_from_dir;
pub use crate::ctbnbdl::load_ledger_nodes_from_file;
pub use crate::ctbnbdl::load_ledger_nodes_from_str;
pub use crate::ctbnbdl::parse_chunk_bundle_filename_start_id;
pub use crate::ctbnbdl::parse_chunk_filename_start_id;
pub use crate::ctbnbdl::parse_for_each_statement_tokens_with;
pub use crate::ctbnbdl::parse_statement_tokens_with;
pub use crate::ctbnbdl::partition_active_and_inactive_nodes_with;
pub use crate::ctbnbdl::push_atom_dc_with;
pub use crate::ctbnbdl::resolve_ctbnbdl_framing_dcs_from_nodes;
pub use crate::ctbnbdl::sanitize_comment;
pub use crate::ctbnbdl::sha256_bytes_hex;
pub use crate::ctbnbdl::sync_highwater_shadow_ledgers;
pub use crate::ctbnbdl::verify_nodes_append_only_against_baseline;
pub use crate::ctbnbdl::verify_repo_graph_append_only;
pub use crate::ctbnbdl::write_chunk_file_append_only;
pub use crate::ctbnbdl::write_ledger_nodes_to_dir;
pub use crate::syntax::ast::NumericBoundValue;
pub use inbox::*;

Modules§

inbox
Manual and staged .ctbnode-incoming node allocation pipeline (nodes/inbox/ -> nodes/allocated/), dynamic effective-state prevalidation, BATCH_COMMITTED provenance verification, and cross-ownership protection between csv and manual graph nodes.

Structs§

LedgerUpdateStats
Statistics returned by a ledger update operation.

Enums§

SeedEntityKey
Seed entity key identifying a classification entity in the System block.

Functions§

decode_ctbnbdl_bundle
Decodes a .ctbnbdl (CtbNodeBundle) binary buffer into its optional leading Dc 641 system block most recent node ID and its list of LedgerNode entries.
decode_ctbnbdl_bundle_resilient
Resiliently decodes a .ctbnbdl (CtbNodeBundle) binary buffer, quarantining any corrupted or checksum-mismatched node section while recovering all remaining valid nodes and returning diagnostic warning strings.
decode_integer_value_tokens
Decodes a canonical base64 integer value node token sequence (6 f199 <base64 digits> 7) back into a u128 (supporting both normalized 6 f199 .. 7 and legacy 6 f199 6 f199 .. 7 7).
decode_nodes_from_ctbnbdl_bytes
Decodes a .ctbnbdl (CtbNodeBundle) binary buffer back into a list of LedgerNode entries (with empty comments, as .ctbnbdl stores only the semantic Dc stream).
decode_string_value_tokens
Decodes a canonical string value node token sequence back into a String, if it matches.
default_ctbnbdl_framing_dcs
Returns the canonical .ctbnbdl framing Document Characters from ctb_formats_dcdata::dc.
default_vary_as_to_format_variant
Returns the default mapping from @vary_as nicknames to .Formats:format_variant shorthands.
encode_for_each_statement_tokens
Encodes a Dc 638 (For each) statement over a typed [atom_dc] list: 638 <inner_verb> [atom_dc: inner_subj] [atom_dc: inner_obj] 310 <list_type> <elem_1> 312 <elem_2> ... 311.
encode_integer_value_tokens
Encodes an unsigned integer into the canonical base64 integer value node token sequence: 6 f199 <base64 digit Dcs 127..=190...> 7.
encode_node_definition_tokens
Encodes a single LedgerNode (id + tokens) into its Dc 617 .. Dc 618 token sequence: 617 [atom_dc: l<id>] <escaped body tokens...> 618.
encode_nodes_to_ctbnbdl_bytes
Compiles a slice of LedgerNode entries into a .ctbnbdl (CtbNodeBundle) binary buffer: 8-byte CTBNBDL\x01 magic + 21-byte DcMM header + UTF-8e-128 encoded 617 .. 618 frames.
encode_statement_tokens
Encodes a relationship statement <verb> [atom_dc] [atom_dc], escaping Dc 255 (Ignore following Dc) and Dc 616 (Evaluate value as atom) with Dc 255.
encode_string_value_tokens
Encodes aUTF-8 string into the canonical string value node token sequence (<u<hex> tokens...>).
explain_ctbnodes_file
Reads a .ctbnodes file from path and renders it with synthesized human-readable explanation comments.
explain_ctbnodes_str
Renders a .ctbnodes text buffer with synthesized human-readable explanation comments (l<id>: <tokens> # [@created_ns:<ts>] <explanation>).
parse_for_each_statement_tokens
Parses a Dc 638 (For each) statement over a typed [atom_dc] list back into (inner_verb, inner_subj, inner_obj, list_type, elements).
parse_statement_tokens
Parses a relationship statement <verb> [atom_dc] [atom_dc] back into (verb, subj, obj).
partition_active_and_inactive_nodes
Partitions nodes into (active_nodes, inactive_nodes) using default_ctbnbdl_framing_dcs.
plan_csv_reconciliation_manifest
Plans a csv_reconciliation transaction manifest against repo_root under LedgerReadGuard and writes the resulting TransactionManifest JSON to out_path.
single_valued_property_set
Returns the canonical set of single-valued property Document Characters.
update_ledger_in_memory
Updates an in-memory list of LedgerNodes against dc_defns, format_defns, known_scripts, and named_types_bytes.
update_ledger_in_memory_with_provenance
Updates an in-memory list of LedgerNodes against dc_defns, format_defns, known_scripts, and named_types_bytes, enforcing provenance_map cross-ownership rules.
update_system_graph_ledger
Loads the CSV dataset from repo_root and updates assets/data/graph/*.ctbnodes using the append-only revision ledger algorithm inside a durable journaled transaction.
update_system_graph_ledger_with_options
Same as update_system_graph_ledger, with optional required_manifest_path, dry_run, and FaultInjectionPoint.