pub struct SeedGraphIndex { /* private fields */ }Expand description
Runtime index over the System-block seed graph (8589934592..=12884901887).
Implementations§
Source§impl SeedGraphIndex
impl SeedGraphIndex
Sourcepub const fn instance_id(&self) -> u64
pub const fn instance_id(&self) -> u64
Returns the process-unique identifier assigned to this SeedGraphIndex instance.
Returns the lazily loaded process-wide SeedGraphIndex from the runtime asset bundle.
Sourcepub fn load_from_asset_bundle() -> Result<SeedGraphIndex, Error>
pub fn load_from_asset_bundle() -> Result<SeedGraphIndex, Error>
Loads all active data/graph/*.ctbnbdl bundle files (beginning with
data/graph/85899_34592.ctbnbdl) from the runtime asset bundle (ctoolbox.rsrc)
and indexes all active statements, seed entities, and value nodes.
Errors strictly by default on any checksum, framing, ordering, or value-immutability
violation unless --recover-graph is enabled on the current invocation.
Sourcepub fn load_from_asset_bundle_with_recovery(
recover_graph: bool,
) -> Result<SeedGraphIndex, Error>
pub fn load_from_asset_bundle_with_recovery( recover_graph: bool, ) -> Result<SeedGraphIndex, Error>
Loads active data/graph/*.ctbnbdl bundles from the runtime asset bundle,
enforcing strict errors when recover_graph is false or quarantining and
warning on damaged sections/invariants when recover_graph is true (--recover-graph).
Sourcepub fn load_with_history_from_asset_bundle() -> Result<SeedGraphIndex, Error>
pub fn load_with_history_from_asset_bundle() -> Result<SeedGraphIndex, Error>
Loads both active data/graph/*.ctbnbdl bundles (from ctoolbox.rsrc) and optional
historical/inactive data/graph/system/*.ctbnbdl bundles (from system_graph_history.rsrc
if installed, or assets/data/graph/system/ in dev mode), merging them in ascending
node ID order and resolving all Dc 591 (Supersedes) and Dc 592 (Retracts) history.
Sourcepub fn load_at_most_recent_from_asset_bundle(
most_recent_node_id: u128,
) -> Result<Arc<SeedGraphIndex>, Error>
pub fn load_at_most_recent_from_asset_bundle( most_recent_node_id: u128, ) -> Result<Arc<SeedGraphIndex>, Error>
Loads a SeedGraphIndex pinned to the System-block state as of most_recent_node_id
(Dc 641 "Global graph system block most recent node ID at time of document creation").
If most_recent_node_id matches the shared HEAD seed graph’s
system_block_most_recent_node_id(), returns the shared HEAD index in $O(1)$.
If most_recent_node_id exceeds HEAD, returns an error rather than silently
substituting HEAD. Otherwise, loads active and historical .ctbnbdl bundles,
verifies that historical coverage is complete up to most_recent_node_id, and
reconstructs the graph state as of most_recent_node_id.
Sourcepub fn from_active_and_history_nodes_at_most_recent(
active_most_recent: Option<u128>,
active_nodes: Vec<LedgerNode>,
history_most_recent: Option<u128>,
history_nodes: Vec<LedgerNode>,
most_recent_node_id: u128,
) -> Result<SeedGraphIndex, Error>
pub fn from_active_and_history_nodes_at_most_recent( active_most_recent: Option<u128>, active_nodes: Vec<LedgerNode>, history_most_recent: Option<u128>, history_nodes: Vec<LedgerNode>, most_recent_node_id: u128, ) -> Result<SeedGraphIndex, Error>
Reconstructs a SeedGraphIndex pinned to most_recent_node_id from separate
active (data/graph/*.ctbnbdl) and historical (data/graph/system/*.ctbnbdl)
node lists, enforcing snapshot bounds and historical bundle completeness.
Sourcepub fn from_ctbnbdl_bytes(bytes: &[u8]) -> Result<SeedGraphIndex, Error>
pub fn from_ctbnbdl_bytes(bytes: &[u8]) -> Result<SeedGraphIndex, Error>
Decodes a single .ctbnbdl byte slice strictly and builds a SeedGraphIndex.
Fails immediately on any checksum mismatch, malformed section, supersession cycle,
or pure-value Dc 591 / Dc 592 revision.
Sourcepub fn from_ctbnbdl_bytes_resilient(
bytes: &[u8],
) -> Result<(SeedGraphIndex, Vec<String>), Error>
pub fn from_ctbnbdl_bytes_resilient( bytes: &[u8], ) -> Result<(SeedGraphIndex, Vec<String>), Error>
Resiliently decodes a .ctbnbdl byte slice (for --recover-graph), logging and
returning any section-quarantine or graph-invariant warnings while building a
SeedGraphIndex from all recovered valid nodes.
Sourcepub fn from_nodes(nodes: Vec<LedgerNode>) -> SeedGraphIndex
pub fn from_nodes(nodes: Vec<LedgerNode>) -> SeedGraphIndex
Builds a SeedGraphIndex from an ordered list of LedgerNodes using the default
single-valued property set.
Sourcepub fn from_bundled_nodes(nodes: Vec<LedgerNode>) -> SeedGraphIndex
pub fn from_bundled_nodes(nodes: Vec<LedgerNode>) -> SeedGraphIndex
Builds a SeedGraphIndex from an ordered list of host-authenticated bundled LedgerNodes
(loaded from ctoolbox.rsrc / system_graph_history.rsrc), marking all supplied System-region
nodes as having authenticated bundled origin.
Sourcepub fn from_bundled_nodes_at_most_recent(
nodes: Vec<LedgerNode>,
most_recent_node_id: u128,
) -> SeedGraphIndex
pub fn from_bundled_nodes_at_most_recent( nodes: Vec<LedgerNode>, most_recent_node_id: u128, ) -> SeedGraphIndex
Builds a SeedGraphIndex pinned to most_recent_node_id from an ordered list of
host-authenticated bundled LedgerNodes without marking from_asset_bundle.
Sourcepub fn load_merged_nodes_from_disk_graph_dir(
graph_dir: &Path,
) -> Result<Vec<LedgerNode>, Error>
pub fn load_merged_nodes_from_disk_graph_dir( graph_dir: &Path, ) -> Result<Vec<LedgerNode>, Error>
Loads and merges all active (<graph_dir>/*.ctbnbdl) and historical
(<graph_dir>/system/*.ctbnbdl) System-graph bundles directly from disk in
strictly ascending node ID order.
§Errors
Returns an error if <graph_dir> contains no .ctbnbdl files, if any bundle
fails decoding or ordering checks, or if duplicate node IDs exist across active
and historical bundles.
Sourcepub fn from_bundled_and_extra_nodes(
bundled_nodes: Vec<LedgerNode>,
extra_nodes: Vec<LedgerNode>,
) -> Result<SeedGraphIndex, Error>
pub fn from_bundled_and_extra_nodes( bundled_nodes: Vec<LedgerNode>, extra_nodes: Vec<LedgerNode>, ) -> Result<SeedGraphIndex, Error>
Builds a SeedGraphIndex combining host-authenticated bundled System nodes (bundled_nodes)
with extra/unbundled nodes (extra_nodes, such as Wikidata or external resource bundles).
Only nodes originating from bundled_nodes are recorded in bundled_origin_node_ids;
extra_nodes cannot supply bootstrap authority even if their numeric node IDs or
self-asserted Dc 635 provenance claims mimic bundled System nodes.
Sourcepub fn from_nodes_at_most_recent(
nodes: Vec<LedgerNode>,
most_recent_node_id: u128,
) -> SeedGraphIndex
pub fn from_nodes_at_most_recent( nodes: Vec<LedgerNode>, most_recent_node_id: u128, ) -> SeedGraphIndex
Builds a SeedGraphIndex reflecting the System-block graph state as of most_recent_node_id
(Dc 641 "Global graph system block most recent node ID at time of document creation"),
ignoring any statements, supersessions (Dc 591), or retractions (Dc 592) allocated
with node.id > most_recent_node_id.
Sourcepub fn from_nodes_with_single_props(
nodes: Vec<LedgerNode>,
single_valued_props: &HashSet<DcShorthand>,
) -> SeedGraphIndex
pub fn from_nodes_with_single_props( nodes: Vec<LedgerNode>, single_valued_props: &HashSet<DcShorthand>, ) -> SeedGraphIndex
Builds a SeedGraphIndex from nodes and a custom set of single-valued property Dcs.
Sourcepub fn collect_graph_invariant_anomalies(&self) -> Vec<String>
pub fn collect_graph_invariant_anomalies(&self) -> Vec<String>
Collects semantic graph invariant anomalies (supersession cycles, or active
Dc 591 / Dc 592 statements revising pure value nodes other than Dc 348
disambiguation lists).
Sourcepub fn validate_or_warn_graph_invariants(
&self,
recover_graph: bool,
) -> Result<(), Error>
pub fn validate_or_warn_graph_invariants( &self, recover_graph: bool, ) -> Result<(), Error>
Validates semantic graph invariants: errors strictly when recover_graph is false
(the default), or logs warnings and continues when recover_graph is true (--recover-graph).
Sourcepub fn system_block_most_recent_node_id(&self) -> Option<u128>
pub fn system_block_most_recent_node_id(&self) -> Option<u128>
Returns the highest allocated node ID in the System block at the time the graph bundle
was created (Dc 641 "Global graph system block most recent node ID at time of document creation").
Sourcepub const fn is_from_asset_bundle(&self) -> bool
pub const fn is_from_asset_bundle(&self) -> bool
Returns true if this SeedGraphIndex was loaded from the runtime
asset bundle (ctoolbox.rsrc / system_graph_history.rsrc), meaning
historical Dc 641 pins must be reconstructed via the asset bundle
(merging data/graph/ and data/graph/system/) rather than slicing
active-only nodes in memory.
Sourcepub fn node_data_source(&self, node_id: u128) -> Option<DcShorthand>
pub fn node_data_source(&self, node_id: u128) -> Option<DcShorthand>
Returns the declared Dc 635 ("Collective Toolbox seed graph data source") token
for node_id in the seed graph, if present.
Sourcepub fn has_in_graph_provenance(&self) -> bool
pub fn has_in_graph_provenance(&self) -> bool
Returns true if the seed graph contains any Dc 635 ("Collective Toolbox seed graph data source")
provenance declarations.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Returns the total number of nodes in the loaded seed graph.
Sourcepub fn nodes(&self) -> &[LedgerNode]
pub fn nodes(&self) -> &[LedgerNode]
Returns a slice of all loaded LedgerNodes.
Sourcepub fn get_node(&self, id: u128) -> Option<&LedgerNode>
pub fn get_node(&self, id: u128) -> Option<&LedgerNode>
Looks up a LedgerNode by its global node ID (u128).
Sourcepub fn is_node_active(&self, id: u128) -> bool
pub fn is_node_active(&self, id: u128) -> bool
Returns true if id exists in the seed graph and has not been superseded or retracted.
Sourcepub fn inactive_count(&self) -> usize
pub fn inactive_count(&self) -> usize
Returns the total number of inactive (superseded or retracted) nodes in the seed graph.
Sourcepub fn superseded_count(&self) -> usize
pub fn superseded_count(&self) -> usize
Returns the number of superseded nodes (Dc 591) in the seed graph.
Sourcepub fn retracted_count(&self) -> usize
pub fn retracted_count(&self) -> usize
Returns the number of retracted nodes (Dc 592) in the seed graph.
Sourcepub fn get_ambiguous_candidates(&self, id: u128) -> Option<Vec<u128>>
pub fn get_ambiguous_candidates(&self, id: u128) -> Option<Vec<u128>>
Follows any Dc 591 "Supersedes" chain from id to its terminal replacement node,
and if that node (or id itself) is a Dc 348 "Ambiguous values" list (348 310 ... 311),
returns the ordered candidate node IDs.
Sourcepub fn superseded_by(&self, id: u128) -> Option<u128>
pub fn superseded_by(&self, id: u128) -> Option<u128>
Returns the node ID that directly superseded id via Dc 591 (Supersedes), if any.
Sourcepub fn retracted_by(&self, id: u128) -> Option<u128>
pub fn retracted_by(&self, id: u128) -> Option<u128>
Returns the statement node ID that retracted id via Dc 592 (Retracts), if any.
Sourcepub fn resolve_latest_node_id(&self, id: u128) -> Option<u128>
pub fn resolve_latest_node_id(&self, id: u128) -> Option<u128>
Follows any Dc 591 (Supersedes) chain starting from id to its latest active node ID,
returning None if id is unknown, if the terminal revision was retracted (Dc 592),
or if a supersession cycle is encountered.
Sourcepub fn get_active_node(&self, id: u128) -> Option<&LedgerNode>
pub fn get_active_node(&self, id: u128) -> Option<&LedgerNode>
Resolves id through any active Dc 591 (Supersedes) chain within this snapshot
and returns the active terminal LedgerNode, or None if id is unknown, retracted
(Dc 592), or outside the snapshot.
Sourcepub fn query_active_node_verbatim(&self, id: u128) -> Option<&[DcShorthand]>
pub fn query_active_node_verbatim(&self, id: u128) -> Option<&[DcShorthand]>
Returns the exact verbatim Dc token slice inside an active node id
without following supersession chains or expanding child references.
Sourcepub fn query_active_nodes_by_exact_tokens(
&self,
tokens: &[DcShorthand],
) -> &[u128]
pub fn query_active_nodes_by_exact_tokens( &self, tokens: &[DcShorthand], ) -> &[u128]
Returns all active node IDs (sorted ascending) in the snapshot whose
verbatim token slice equals tokens exactly.
Sourcepub fn query_active_relationship_triples(
&self,
verb: Option<DcShorthand>,
subj: Option<DcShorthand>,
obj: Option<DcShorthand>,
) -> Vec<(u128, DcShorthand, DcShorthand, DcShorthand)>
pub fn query_active_relationship_triples( &self, verb: Option<DcShorthand>, subj: Option<DcShorthand>, obj: Option<DcShorthand>, ) -> Vec<(u128, DcShorthand, DcShorthand, DcShorthand)>
Queries all active relationship triples (stmt_id, verb, subj, obj)
in the snapshot matching the supplied pattern (None = Dc 600
wildcard). Includes both direct 3-token statements and Dc 638
for-each distributions.
Sourcepub fn get_string(&self, tok: DcShorthand) -> Option<&str>
pub fn get_string(&self, tok: DcShorthand) -> Option<&str>
Resolves tok as a string value node (DcShorthand::Long(id)), returning its decoded UTF-8 string.
Sourcepub fn get_integer(&self, tok: DcShorthand) -> Option<u128>
pub fn get_integer(&self, tok: DcShorthand) -> Option<u128>
Resolves tok as an integer value node (DcShorthand::Long(id)), returning its decoded u128.
Sourcepub fn get_seed_entity_id(&self, key: &SeedEntityKey) -> Option<u128>
pub fn get_seed_entity_id(&self, key: &SeedEntityKey) -> Option<u128>
Looks up the allocated u128 node ID for a SeedEntityKey.
Sourcepub fn get_seed_entity(&self, id: u128) -> Option<&SeedEntityKey>
pub fn get_seed_entity(&self, id: u128) -> Option<&SeedEntityKey>
Looks up the SeedEntityKey for a seed entity node ID (u128),
resolving through any active Dc 591 (Supersedes) chain in the snapshot.
Sourcepub fn get_single_property(
&self,
subj: DcShorthand,
prop: DcShorthand,
) -> Option<DcShorthand>
pub fn get_single_property( &self, subj: DcShorthand, prop: DcShorthand, ) -> Option<DcShorthand>
Returns the active value token for a single-valued property (subj, prop).
Sourcepub fn get_single_property_entry(
&self,
subj: DcShorthand,
prop: DcShorthand,
) -> Option<ActivePropertyValue>
pub fn get_single_property_entry( &self, subj: DcShorthand, prop: DcShorthand, ) -> Option<ActivePropertyValue>
Returns the full ActivePropertyValue (has_a_id, has_val_id, value) for a
single-valued property (subj, prop).
Sourcepub fn get_single_property_string(
&self,
subj: DcShorthand,
prop: DcShorthand,
) -> Option<&str>
pub fn get_single_property_string( &self, subj: DcShorthand, prop: DcShorthand, ) -> Option<&str>
Returns the decoded UTF-8 string of a single-valued string property (subj, prop).
Sourcepub fn get_single_property_integer(
&self,
subj: DcShorthand,
prop: DcShorthand,
) -> Option<u128>
pub fn get_single_property_integer( &self, subj: DcShorthand, prop: DcShorthand, ) -> Option<u128>
Returns the decoded u128 integer of a single-valued integer property (subj, prop).
Sourcepub fn get_multi_properties(
&self,
subj: DcShorthand,
prop: DcShorthand,
) -> &[ActivePropertyValue]
pub fn get_multi_properties( &self, subj: DcShorthand, prop: DcShorthand, ) -> &[ActivePropertyValue]
Returns all active ActivePropertyValue entries for a multi-valued property (subj, prop).
Sourcepub fn get_preferred_replacements(&self, subj: DcShorthand) -> &[DcShorthand]
pub fn get_preferred_replacements(&self, subj: DcShorthand) -> &[DcShorthand]
Returns all active preferred replacement target tokens (<prefer>) for subj.
Sourcepub fn has_direct_statement(
&self,
verb: DcShorthand,
subj: DcShorthand,
obj: DcShorthand,
) -> bool
pub fn has_direct_statement( &self, verb: DcShorthand, subj: DcShorthand, obj: DcShorthand, ) -> bool
Returns true if the direct binary statement (verb, subj, obj) is currently active.
Sourcepub fn has_stable_programmatic_identifier(&self, subj: DcShorthand) -> bool
pub fn has_stable_programmatic_identifier(&self, subj: DcShorthand) -> bool
Returns true if subj’s active Dc 574 "Programmatic identifier" (Has a statement node)
has an active Dc 645 "Is stable" statement (645 l<ident_has_a_id> 517) that is
Dc 646 "In context of" f649 (Collective Toolbox).
Sourcepub fn get_direct_objects(
&self,
verb: DcShorthand,
subj: DcShorthand,
) -> &[DcShorthand]
pub fn get_direct_objects( &self, verb: DcShorthand, subj: DcShorthand, ) -> &[DcShorthand]
Returns all active object tokens obj for direct binary statements (verb, subj, obj).
Sourcepub fn get_direct_subjects(
&self,
verb: DcShorthand,
obj: DcShorthand,
) -> &[DcShorthand]
pub fn get_direct_subjects( &self, verb: DcShorthand, obj: DcShorthand, ) -> &[DcShorthand]
Returns all active subject tokens subj for direct binary statements (verb, subj, obj).
Sourcepub fn seed_entities(&self) -> &HashMap<SeedEntityKey, u128>
pub fn seed_entities(&self) -> &HashMap<SeedEntityKey, u128>
Returns a map of all indexed SeedEntityKey entries to their allocated u128 node IDs.
Sourcepub fn active_single_props(
&self,
) -> &BTreeMap<(DcShorthand, DcShorthand), (u128, u128, DcShorthand)>
pub fn active_single_props( &self, ) -> &BTreeMap<(DcShorthand, DcShorthand), (u128, u128, DcShorthand)>
Returns the map of all active single-valued properties (subject, prop_token) -> (has_a_id, has_val_id, val_token).
Sourcepub fn active_multi_props(
&self,
) -> &BTreeMap<(DcShorthand, DcShorthand, DcShorthand), (u128, u128)>
pub fn active_multi_props( &self, ) -> &BTreeMap<(DcShorthand, DcShorthand, DcShorthand), (u128, u128)>
Returns the map of all active multi-valued properties (subject, prop_token, val_token) -> (has_a_id, has_val_id).
Sourcepub fn active_preferred(
&self,
) -> &BTreeMap<(DcShorthand, DcShorthand), (u128, u128, u128)>
pub fn active_preferred( &self, ) -> &BTreeMap<(DcShorthand, DcShorthand), (u128, u128, u128)>
Returns the map of all active preferred replacements (subject, val_token) -> (has_a_id, has_val_id, pref_qual_id).
Sourcepub fn active_direct_stmts(
&self,
) -> &BTreeMap<(DcShorthand, DcShorthand, DcShorthand), u128>
pub fn active_direct_stmts( &self, ) -> &BTreeMap<(DcShorthand, DcShorthand, DcShorthand), u128>
Returns the map of all active direct binary statements (verb, subject, object) -> stmt_id.
Sourcepub fn get_syntax_rule_tokens(
&self,
subj: DcShorthand,
) -> Option<&[DcShorthand]>
pub fn get_syntax_rule_tokens( &self, subj: DcShorthand, ) -> Option<&[DcShorthand]>
Returns the raw .Semantic:Pattern token slice for the active Dc 594 (Syntax rule)
property on subj, without allocating or decoding a Rust SyntaxPattern AST.
Sourcepub fn get_named_construct_tokens(&self, name: &str) -> Option<&[DcShorthand]>
pub fn get_named_construct_tokens(&self, name: &str) -> Option<&[DcShorthand]>
Returns the raw .Semantic:Pattern token slice for a named syntax construct
(e.g. "number", "string", "value"), without allocating a Rust SyntaxPattern AST.
Sourcepub fn tokens_start_wasm_definition(tokens: &[DcShorthand]) -> bool
pub fn tokens_start_wasm_definition(tokens: &[DcShorthand]) -> bool
Returns true if tokens begins with a Dc-WASM program (Dc 1927 "Begin WASM program")
or a wasm_routine literal (Dc 260 "Begin literal value", Dc 262 "Begin type definition",
Dc 280 "Built-in type identifier: Routine").
Sourcepub fn tokens_are_wasm_helper_or_definition(
&self,
tokens: &[DcShorthand],
) -> bool
pub fn tokens_are_wasm_helper_or_definition( &self, tokens: &[DcShorthand], ) -> bool
Returns true if tokens represents a Dc-WASM program, wasm_routine literal,
WASM instruction/member helper fragment, or transitive reference to one in this snapshot.
Sourcepub fn get_wasm_definition_tokens(
&self,
subj: DcShorthand,
) -> Option<&[DcShorthand]>
pub fn get_wasm_definition_tokens( &self, subj: DcShorthand, ) -> Option<&[DcShorthand]>
Resolves any active .WASM program (Dc 1927 "Begin WASM program"..Dc 1928 "End WASM program"),
wasm_routine definition, or transitive WASM helper attached to subj via
Dc 611 "Canonical decomposition", Dc 571 "Decomposition",
Dc 614 "Semantic decomposition", or a trailing Dc 607 "Pattern replacement"
action inside subj’s Dc 594 "Syntax rule".
Sourcepub fn get_wasm_definition_tokens_in_context(
&self,
subj: DcShorthand,
context_tokens: &[DcShorthand],
) -> Option<&[DcShorthand]>
pub fn get_wasm_definition_tokens_in_context( &self, subj: DcShorthand, context_tokens: &[DcShorthand], ) -> Option<&[DcShorthand]>
Resolves any active context-scoped .WASM program (Dc 1927 "Begin WASM program"..Dc 1928 "End WASM program")
or wasm_routine definition attached to subj whose Dc 646 "In context of" qualifier
matches context_tokens (preferring an exact match over a trailing Dc 275 "*" wildcard prefix).
Sourcepub fn list_active_contextual_wasm_definitions(
&self,
subj: DcShorthand,
) -> Vec<(Vec<DcShorthand>, Vec<DcShorthand>)>
pub fn list_active_contextual_wasm_definitions( &self, subj: DcShorthand, ) -> Vec<(Vec<DcShorthand>, Vec<DcShorthand>)>
Lists all active context-scoped .WASM (Dc 1927..Dc 1928) definitions attached to
subj in this snapshot ((context_tokens, expanded_wasm_tokens)), expanding interned
Unicode runs and wrapping standalone Dc 260..Dc 261 routines in Dc 1927..Dc 1928.
Sourcepub fn resolve_wasm_helper_shorthand(
&self,
subj: DcShorthand,
) -> Result<Option<(Option<u128>, &[DcShorthand])>, Error>
pub fn resolve_wasm_helper_shorthand( &self, subj: DcShorthand, ) -> Result<Option<(Option<u128>, &[DcShorthand])>, Error>
Resolves subj (DcShorthand::Short or DcShorthand::Format) as a WASM helper or
definition in this snapshot via Dc 611 "Canonical decomposition",
Dc 571 "Decomposition", Dc 614 "Semantic decomposition", or a trailing
Dc 607 "Pattern replacement" action inside subj’s Dc 594 "Syntax rule".
§Errors
Returns an error if subj’s WASM decomposition or target node was retracted in this
snapshot, targets an unsupported graph block, or exceeds the pinned System graph snapshot.
Sourcepub fn get_entity_class(&self, entity_id: u128) -> Option<DcShorthand>
pub fn get_entity_class(&self, entity_id: u128) -> Option<DcShorthand>
Returns the <class_tok> of an active non-seed entity node (586 615 <class_tok>),
if entity_id is an active entity in this snapshot.
Sourcepub fn is_transformation_format_subject(&self, subj: DcShorthand) -> bool
pub fn is_transformation_format_subject(&self, subj: DcShorthand) -> bool
Returns true if subj is a DcShorthand::Format(_) whose active script in this
snapshot is .Formats:transformation.
Sourcepub fn list_all_active_converter_steps(
&self,
) -> Result<Vec<ActiveConverterStep<'_>>, Error>
pub fn list_all_active_converter_steps( &self, ) -> Result<Vec<ActiveConverterStep<'_>>, Error>
Lists all active single-step converters ([Dc 302 "Type conversion", src, dst]) in this
snapshot across standalone Routine entities (Dc 280) and .Formats:transformation
Format Dcs (DcShorthand::Format(_)), ordered with Dc 570 "Preferred" entries first and
ties broken by ascending global Dc ID.
§Errors
Returns an error if an active converter’s decomposition target node was retracted, references an unsupported graph block, or exceeds the pinned System graph snapshot.
Sourcepub fn resolve_active_converter_chain(
&self,
src: DcShorthand,
dst: DcShorthand,
) -> Result<Option<Vec<ActiveConverterStep<'_>>>, Error>
pub fn resolve_active_converter_chain( &self, src: DcShorthand, dst: DcShorthand, ) -> Result<Option<Vec<ActiveConverterStep<'_>>>, Error>
Resolves the shortest active conversion path ([Dc 302 src_0 dst_0], …,
[Dc 302 src_k dst]) from src to dst in this snapshot, preferring Dc 570 "Preferred"
converters at each hop and breaking ties deterministically by ascending global Dc ID.
§Errors
Returns an error if any candidate converter’s target node is invalid in this snapshot.
Sourcepub fn resolve_active_converter_routine(
&self,
src: DcShorthand,
dst: DcShorthand,
) -> Result<Option<(u128, &[DcShorthand])>, Error>
pub fn resolve_active_converter_routine( &self, src: DcShorthand, dst: DcShorthand, ) -> Result<Option<(u128, &[DcShorthand])>, Error>
Resolves the highest-precedence direct .WASM converter ([Dc 302 "Type conversion", src, dst])
in this snapshot (either a .Formats:transformation Format Dc or a standalone Routine
entity), returning (subject_global_dc_id, wasm_tokens).
§Errors
Returns an error if a matching active converter’s target node was retracted, references an unsupported graph block, or exceeds the pinned System graph snapshot.
Sourcepub fn expand_interned_string_nodes(
&self,
tokens: &[DcShorthand],
) -> Vec<DcShorthand>
pub fn expand_interned_string_nodes( &self, tokens: &[DcShorthand], ) -> Vec<DcShorthand>
Expands interned [string] (Dc 260 .. Dc 261), comment
(Dc 246/247..248, Dc 249/250..251), identifier (Dc 270..271), and
legacy pre-cleanup pure-Unicode run nodes back into inline Dc tokens.
Sourcepub fn tokens_are_stagel_item_or_module(
&self,
raw_tokens: &[DcShorthand],
) -> bool
pub fn tokens_are_stagel_item_or_module( &self, raw_tokens: &[DcShorthand], ) -> bool
Returns true if raw_tokens (after expanding interned [string]
nodes and skipping leading single-line comment frames) begins with a
StageL 3 module or top-level declaration Token Dc.
Sourcepub fn resolve_stagel_decomposition_tokens(
&self,
subj: DcShorthand,
) -> Result<Option<(u128, Vec<DcChar>)>, Error>
pub fn resolve_stagel_decomposition_tokens( &self, subj: DcShorthand, ) -> Result<Option<(u128, Vec<DcChar>)>, Error>
Resolves subj (DcShorthand::Long, Short, or Format) to its active StageL 3
Token-Dc decomposition ((value_node_id, expanded_dc_chars)) in this snapshot via
Dc 611 "Canonical decomposition", Dc 571 "Decomposition", or
Dc 614 "Semantic decomposition".
§Errors
Returns an error if subj or its StageL decomposition target node was retracted in this
snapshot (Dc 592 "Retracts"), references an unsupported graph block, or exceeds the
pinned System graph snapshot (Dc 641).
Sourcepub fn resolve_stagel_namespace_exports(
&self,
ns_segments: &[String],
) -> Result<BTreeMap<String, Vec<DcShorthand>>, Error>
pub fn resolve_stagel_namespace_exports( &self, ns_segments: &[String], ) -> Result<BTreeMap<String, Vec<DcShorthand>>, Error>
Resolves all active pub StageL symbols exported in ns_segments (f229 "File path"
context on Dc 574 "Programmatic identifier"), returning a deterministic map of
export_name -> Vec<subject_dc_shorthand> (supporting fixed-arity parameter-type
routine overloads and typed constant overloads within the same namespace).
Sourcepub fn resolve_stagel_entity_namespace(
&self,
subj: DcShorthand,
) -> Result<Option<Vec<String>>, Error>
pub fn resolve_stagel_entity_namespace( &self, subj: DcShorthand, ) -> Result<Option<Vec<String>>, Error>
Resolves the declared PSR-4 StageL/StageR namespace segments (f229 "File path"
context on Dc 574 "Programmatic identifier") for an exported StageL/StageR entity
subj, returning Ok(None) when subj has no FilePath-contextualized programmatic
identifier in the active snapshot.
Sourcepub fn resolve_stagel_routine_metadata(
&self,
subj: DcShorthand,
) -> Result<StagelRoutineGraphMeta, Error>
pub fn resolve_stagel_routine_metadata( &self, subj: DcShorthand, ) -> Result<StagelRoutineGraphMeta, Error>
Resolves decoupled non-executable metadata (is_pub, Dc 574 name, home namespace
via Dc 646 or Dc 598, Dc 573 description, and Dc 1942 test suite tokens)
attached to a StageL/StageR routine entity or direct Dc 2240..2241 value node subj.
Sourcepub fn is_trusted_seed_graph_data_source(source: DcShorthand) -> bool
pub fn is_trusted_seed_graph_data_source(source: DcShorthand) -> bool
Returns true if source is a trusted Collective Toolbox seed graph provenance source:
Dc 636 "Collective Toolbox Dc CSV seed database" or Dc 637 "Manual entry".
Sourcepub fn is_bundled_origin_node(&self, node_id: u128) -> bool
pub fn is_bundled_origin_node(&self, node_id: u128) -> bool
Returns true if node_id originated from the host-authenticated bundled asset
(ctoolbox.rsrc / system_graph_history.rsrc).
Sourcepub fn verify_authenticated_bundled_system_provenance(
&self,
node_id: u128,
) -> Result<(), Error>
pub fn verify_authenticated_bundled_system_provenance( &self, node_id: u128, ) -> Result<(), Error>
Verifies that node_id resides in the System block (8_589_934_592..=17_179_869_183),
originated from the host-authenticated bundled asset (ctoolbox.rsrc /
system_graph_history.rsrc), and carries verified Dc 635
("Collective Toolbox seed graph data source") provenance (Dc 636 or Dc 637)
asserted by bundled System-block provenance statements.
§Errors
Returns an error if node_id is outside the System block, missing from the index,
from an extra/unbundled resource, missing Dc 635 provenance, or associated with an
untrusted or unbundled Dc 635 provenance statement.
Sourcepub fn verify_node_supersession_and_retraction_chain(
&self,
node_id: u128,
) -> Result<(), Error>
pub fn verify_node_supersession_and_retraction_chain( &self, node_id: u128, ) -> Result<(), Error>
Verifies that node_id and every Dc 591 "Supersedes" / Dc 592 "Retracts" statement
along its revision chain satisfy Self::verify_authenticated_bundled_system_provenance.
Sourcepub fn verify_subject_provenance_and_history(
&self,
subj: DcShorthand,
) -> Result<(), Error>
pub fn verify_subject_provenance_and_history( &self, subj: DcShorthand, ) -> Result<(), Error>
Verifies that every statement (active or historical) touching subj, together with all
Dc 610 "Has value" value statements and Dc 591 "Supersedes" / Dc 592 "Retracts"
statements on those chains, satisfies Self::verify_authenticated_bundled_system_provenance.
Sourcepub fn resolve_trusted_system_supervisor_bootstrap_tokens(
&self,
bootstrap_tokens: &[DcShorthand],
) -> Result<TrustedSystemSupervisorResolution, Error>
pub fn resolve_trusted_system_supervisor_bootstrap_tokens( &self, bootstrap_tokens: &[DcShorthand], ) -> Result<TrustedSystemSupervisorResolution, Error>
Resolves an unpinned 1-Short-Dc bootstrap entry document (bootstrap_tokens) to its
latest trusted System-block definition from the application-bundled trusted base (ctoolbox.rsrc).
§Errors
Returns an error if bootstrap_tokens is empty, begins with a Dc 641 pin, contains
multiple tokens or a non-Short Dc, or if any statement, supersession/retraction chain,
or transitive dependency fails authenticated bundled System provenance verification.
Sourcepub fn resolve_trusted_system_supervisor_dc(
&self,
entry_dc: DcChar,
) -> Result<TrustedSystemSupervisorResolution, Error>
pub fn resolve_trusted_system_supervisor_dc( &self, entry_dc: DcChar, ) -> Result<TrustedSystemSupervisorResolution, Error>
Resolves the unpinned Short Dc entry_dc to its latest active System-block supervisor
definition, verifying authenticated bundled-origin statement provenance (ctoolbox.rsrc +
trusted Dc 635 = Dc 636 or Dc 637) across the entry character’s statements,
supersession (Dc 591) and retraction (Dc 592) chains, and all transitive dependencies.
Sourcepub fn discover_system_wasm_substitute_targets(
&self,
) -> Result<Vec<SystemWasmSubstituteTarget>, Error>
pub fn discover_system_wasm_substitute_targets( &self, ) -> Result<Vec<SystemWasmSubstituteTarget>, Error>
Auto-discovers all runnable graph Dcs and standalone .WASM value nodes active at
this snapshot (Dc 1936, active .WASM/StageL/StageR [Dc 302 src dst] converters,
standalone uncontextualized .WASM modules, standalone pub dc/<shorthand>
StageL/StageR routines with (l/u8 -> l/u8) or (dcs -> dcs) signatures, and
unowned standalone Dc 1927..Dc 1928 value nodes), sorted deterministically by
ascending (global_id, defining_node_id).
§Errors
Returns an error if strict is true and any discovered target fails shorthand
global-ID resolution or decomposition inspection.
Sourcepub fn compute_substitute_target_revision_sha256(
&self,
target: &SystemWasmSubstituteTarget,
) -> Result<[u8; 32], Error>
pub fn compute_substitute_target_revision_sha256( &self, target: &SystemWasmSubstituteTarget, ) -> Result<[u8; 32], Error>
Computes the deterministic SHA-256 closure digest ([u8; 32]) of a
SystemWasmSubstituteTarget across its active source and compiler dependencies
in this SeedGraphIndex snapshot.
§Errors
Returns an error if target’s active decomposition or converter chain is missing.
Source§impl SeedGraphIndex
impl SeedGraphIndex
Sourcepub fn reconstruct_dc_defns(&self) -> Result<Vec<DcDefn>, Error>
pub fn reconstruct_dc_defns(&self) -> Result<Vec<DcDefn>, Error>
Reconstructs all Document Character definitions (DcDefn for Unicode clarifications and Short Dcs)
directly from the indexed seed graph, sorted in ascending dc_id order.
Sourcepub fn reconstruct_format_defns(&self) -> Result<Vec<DcDefn>, Error>
pub fn reconstruct_format_defns(&self) -> Result<Vec<DcDefn>, Error>
Reconstructs all Format definitions (DcShorthand::Format(_)) from the active seed graph
statements, sorted by ascending dc_id.
Sourcepub fn reconstruct_named_types(
&self,
) -> Result<Vec<ReconstructedNamedType>, Error>
pub fn reconstruct_named_types( &self, ) -> Result<Vec<ReconstructedNamedType>, Error>
Reconstructs all active named syntax constructs (SeedEntityKey::NamedConstruct)
that define a Dc 594 (Syntax rule) in the seed graph, ordered by ascending
entity node ID.
Sourcepub fn decode_format_expr_node(
&self,
node_id: u128,
) -> Result<FormatExpr, Error>
pub fn decode_format_expr_node( &self, node_id: u128, ) -> Result<FormatExpr, Error>
Decodes a FormatExpr value node by its node_id.
Sourcepub fn decode_pattern_node(&self, node_id: u128) -> Result<DcSyntaxRule, Error>
pub fn decode_pattern_node(&self, node_id: u128) -> Result<DcSyntaxRule, Error>
Decodes a .Semantic:Pattern value node by its node_id into a DcSyntaxRule.
Sourcepub fn decode_syntax_rule_for_subject(
&self,
subj: DcShorthand,
) -> Result<Option<DcSyntaxRule>, Error>
pub fn decode_syntax_rule_for_subject( &self, subj: DcShorthand, ) -> Result<Option<DcSyntaxRule>, Error>
Resolves and decodes the active Dc 594 (Syntax rule) property for subj, if present.
Sourcepub fn decode_named_construct_pattern(
&self,
name: &str,
) -> Result<Option<SyntaxPattern>, Error>
pub fn decode_named_construct_pattern( &self, name: &str, ) -> Result<Option<SyntaxPattern>, Error>
Resolves and decodes the active SyntaxPattern for a named syntax construct
(e.g. "number", "string", "value"), if present in the seed graph.
Sourcepub fn decode_syntax_rule_tokens(
&self,
tokens: &[DcShorthand],
) -> Result<DcSyntaxRule, Error>
pub fn decode_syntax_rule_tokens( &self, tokens: &[DcShorthand], ) -> Result<DcSyntaxRule, Error>
Decodes a .Semantic:Pattern token sequence into a DcSyntaxRule.
Sourcepub fn strip_pattern_action_tokens<'a>(
&self,
tokens: &'a [DcShorthand],
) -> Result<&'a [DcShorthand], Error>
pub fn strip_pattern_action_tokens<'a>( &self, tokens: &'a [DcShorthand], ) -> Result<&'a [DcShorthand], Error>
Strips any trailing 298 607 ... 299 (Pattern replacement) action group from tokens.
Sourcepub fn pattern_tokens_start_with_self(&self, tokens: &[DcShorthand]) -> bool
pub fn pattern_tokens_start_with_self(&self, tokens: &[DcShorthand]) -> bool
Returns true if the .Semantic:Pattern token sequence begins with Dc 599 "Self reference"
(or an alternation whose first branch begins with Dc 599 "Self reference").
Sourcepub fn pattern_tokens_start_with_self_or_charset(
&self,
tokens: &[DcShorthand],
) -> bool
pub fn pattern_tokens_start_with_self_or_charset( &self, tokens: &[DcShorthand], ) -> bool
Returns true if the .Semantic:Pattern token sequence begins with Dc 599 "Self reference"
or a character set (298 604 ... or 298 602 <non-group> ...).
Sourcepub fn pattern_tokens_can_start_with_token(
&self,
raw_tokens: &[DcShorthand],
pred: &mut impl FnMut(u128) -> bool,
) -> bool
pub fn pattern_tokens_can_start_with_token( &self, raw_tokens: &[DcShorthand], pred: &mut impl FnMut(u128) -> bool, ) -> bool
Returns true if any leading element of tokens (accounting for nullable
leading elements) explicitly targets a character satisfying pred.
Sourcepub fn step_pattern_token_slice<'a>(
&self,
tokens: &'a [DcShorthand],
idx: usize,
) -> Result<(PatternTokenStep<'a>, Quantifier, usize), Error>
pub fn step_pattern_token_slice<'a>( &self, tokens: &'a [DcShorthand], idx: usize, ) -> Result<(PatternTokenStep<'a>, Quantifier, usize), Error>
Steps a single quantified element from tokens at idx without constructing
a SyntaxPattern AST for nested groups (298 ... 299).
Sourcepub fn split_alternation_branches<'a>(
&self,
tokens: &'a [DcShorthand],
) -> Result<Option<Vec<&'a [DcShorthand]>>, Error>
pub fn split_alternation_branches<'a>( &self, tokens: &'a [DcShorthand], ) -> Result<Option<Vec<&'a [DcShorthand]>>, Error>
If tokens is a top-level 298 602 (branch1) (branch2) ... 299 alternation, returns
the inner token slices for each branch without allocating a recursive AST.
Sourcepub fn step_pattern_element_tokens(
&self,
tokens: &[DcShorthand],
idx: usize,
) -> Result<(SyntaxElement, usize), Error>
pub fn step_pattern_element_tokens( &self, tokens: &[DcShorthand], idx: usize, ) -> Result<(SyntaxElement, usize), Error>
Decodes a single quantified SyntaxElement at idx from a .Semantic:Pattern token slice,
returning (element, next_idx).
Trait Implementations§
Source§impl Clone for SeedGraphIndex
impl Clone for SeedGraphIndex
Source§fn clone(&self) -> SeedGraphIndex
fn clone(&self) -> SeedGraphIndex
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !Freeze for SeedGraphIndex
impl RefUnwindSafe for SeedGraphIndex
impl Send for SeedGraphIndex
impl Sync for SeedGraphIndex
impl Unpin for SeedGraphIndex
impl UnwindSafe for SeedGraphIndex
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, U> ExactFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> ExactFrom<T> for Uwhere
U: TryFrom<T>,
fn exact_from(value: T) -> U
§impl<T, U> ExactInto<U> for Twhere
U: ExactFrom<T>,
impl<T, U> ExactInto<U> for Twhere
U: ExactFrom<T>,
fn exact_into(self) -> U
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T, U> OverflowingInto<U> for Twhere
U: OverflowingFrom<T>,
impl<T, U> OverflowingInto<U> for Twhere
U: OverflowingFrom<T>,
fn overflowing_into(self) -> (U, bool)
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);