Skip to main content

ExecGraph

Struct ExecGraph 

Source
pub struct ExecGraph<'a> { /* private fields */ }
Expand description

Read view of committed graph plus optional overlay (ADR-0016).

Implementations§

Source§

impl ExecGraph<'_>

Source

pub fn neighbors(&self, id: NodeId, dir: Direction) -> Vec<RelId>

Source

pub fn for_each_neighbor( &self, id: NodeId, dir: Direction, types: &[String], f: impl FnMut(RelId), )

Overlay-visible neighbors without cloning the base adjacency Vec. The name-keyed boundary spelling: the pattern’s types resolve once here, then Self::for_each_neighbor_resolved compares ids.

Source

pub fn adj_len(&self, id: NodeId, dir: Direction) -> usize

Approximate adjacency degree (see [Graph::adj_len]) — side selection for existence probes (LABS-193). Base delegation only: deliberately not snapshot-filtered (reads.rs’s prologue contract).

Source

pub fn try_find_neighbor<E>( &self, id: NodeId, dir: Direction, types: &[String], f: impl FnMut(RelId) -> Result<bool, E>, ) -> Result<Option<RelId>, E>

The first neighbor of id (in dir, of types) for which f returns true, stopping the walk there — the early-exit idiom for existence probes (LABS-193). No match: Ok(None). The name-keyed boundary spelling: resolves once, then delegates to Self::try_find_neighbor_resolved.

Source§

impl ExecGraph<'_>

The catalog facts of a view (ADR-0363 decision 5): the committed catalog or interner plus the names the view’s write overlay named. The overlay’s redo log is its write record — no second name set — read through RedoOp::catalog_names, so a label, type or key a transaction just wrote is known before the commit publishes it.

Source

pub fn has_label(&self, label: &str) -> bool

Whether this view’s catalog knows label: the committed catalog or a label any scratch write named. The committed contract is monotone (a label outlives its last node); the scratch side keeps it: a create or label change counts even if a later write removed it.

Source

pub fn has_rel_type(&self, rel_type: &str) -> bool

Whether this view’s catalog knows relationship type rel_type; the label contract applies unchanged.

Source

pub fn has_property_key(&self, key: &str) -> bool

Whether this view’s interner knows property key key: the committed interner or a property key any scratch write named. A hit still only suppresses a warning; a miss is a true miss.

Source§

impl<'a> ExecGraph<'a>

Source

pub fn index_facts(&self) -> Result<Vec<IndexFacts>>

The typed facts of every named index, resolved through the one IndexFacts precedence (detail, then backing constraint, then the legacy encoding) in the catalog’s name order — the snapshot a statement-scoped index reader (the 03N95 dynamic-property detector) reads instead of re-spelling the chain over raw IndexDef rows.

Source

pub fn named_indexes(&self) -> Vec<IndexDef>

Source

pub fn named_index(&self, name: &str) -> Option<IndexDef>

Source

pub fn named_constraint(&self, name: &str) -> Option<ConstraintDef>

The named constraint of that name — the ExecGraph::named_index twin, so a by-name existence probe reads one accessor instead of materializing the whole list and scanning it at each site.

Source

pub fn named_index_by_schema( &self, label: &str, property: &str, ) -> Option<IndexDef>

Source

pub fn named_constraints(&self) -> Vec<ConstraintDef>

Source

pub fn create_named_index( &self, name: String, label: String, property: String, ) -> Result<()>

Index DDL: create a standalone index, counted in QueryStats::indexes_added (ADR-0309).

Source

pub fn drop_named_index(&self, name: String) -> Result<()>

Index DDL: drop a standalone index, counted in QueryStats::indexes_removed (ADR-0309).

Source

pub fn create_named_constraint(&self, def: ConstraintDef) -> Result<()>

Source

pub fn drop_named_constraint(&self, name: String) -> Result<()>

Source§

impl ExecGraph<'_>

Source

pub fn node(&self, id: NodeId) -> Option<Node>

Source

pub fn node_exists(&self, id: NodeId) -> bool

Existence check without materializing the node. The profiled hot path (node clones the full Node — labels + property map) makes this the common-case read in a write statement; callers that only need to know a node is present must not pay for its properties.

Source

pub fn node_labels(&self, id: NodeId) -> Option<Vec<String>>

Label ids without materializing properties. Returns owned label strings; callers that only compare labels pay no property map clone.

Source

pub fn rel(&self, id: RelId) -> Option<Relationship>

Source

pub fn rel_ends(&self, id: RelId) -> Option<(NodeId, NodeId)>

Source

pub fn hop(&self, current: NodeId, rid: RelId, dir: Direction) -> Option<NodeId>

Source

pub fn label_count(&self, label: &str) -> u64

Plan-time label cardinality estimate (ADR-0218), forwarded for the exec layer’s pattern-start estimates (ADR-0351).

Source

pub fn rel_exists(&self, id: RelId) -> bool

Existence check without materializing the relationship.

Source

pub fn rel_type_shared(&self, id: RelId) -> Option<Arc<str>>

The type name shared (Arc<str> — one refcount bump off the store’s interned name; the batch record’s copy is the only allocation, and only when the rel is scratch). The selector’s per-walk type reads ride this, never the String clone.

Source

pub fn rel_type(&self, id: RelId) -> Option<String>

Type name without materializing the relationship’s property map.

Source

pub fn node_stub(&self, id: NodeId) -> Option<Node>

Source

pub fn rel_stub(&self, id: RelId) -> Option<Relationship>

Source

pub fn node_prop(&self, id: NodeId, key: &str) -> Option<Value>

Source

pub fn rel_prop(&self, id: RelId, key: &str) -> Option<Value>

Source

pub fn node_prop_keys(&self, id: NodeId) -> Vec<String>

Source

pub fn rel_prop_keys(&self, id: RelId) -> Vec<String>

Source§

impl<'a> ExecGraph<'a>

Source

pub fn lookup_nodes( &self, labels: &[String], props: &BTreeMap<String, Value>, ) -> Option<Vec<NodeId>>

The label/property candidate lookup at the snapshot, ascending and deduplicated: None only when both labels and props are empty — the shape the caller scans for instead — a non-empty seek is always served.

Source

pub fn lookup_nodes_upto( &self, labels: &[String], props: &BTreeMap<String, Value>, cap: Option<usize>, ) -> Option<Vec<NodeId>>

ExecGraph::lookup_nodes for a caller that only needs to know whether more than cap nodes match (Graph::lookup_nodes_upto_at carries the contract: at most cap ids is the complete answer, a longer one only its length). A view with write scratch answers in full: a truncated base subset could lose members to the scratch’s deletions and read as complete.

Source

pub fn lookup_string_contains( &self, labels: &[String], key: &str, needle: &str, ) -> Option<Vec<NodeId>>

None when the base index cannot serve the needle (the gram index rejects empty needles): the caller falls back to a full scan, exactly like the lookup_nodes path, rather than matching nothing.

Source

pub fn lookup_string_prefix( &self, labels: &[String], key: &str, prefix: &str, ) -> Option<Vec<NodeId>>

None when no RANGE index serves the prefix: the caller scans.

Source§

impl ExecGraph<'_>

Source

pub fn create_node( &self, labels: Vec<String>, properties: BTreeMap<String, Value>, ) -> Result<NodeId>

Source

pub fn create_rel( &self, start: NodeId, end: NodeId, rel_type: String, properties: BTreeMap<String, Value>, ) -> Result<RelId>

Source

pub fn add_labels(&self, id: NodeId, labels: &[String])

Source

pub fn remove_labels(&self, id: NodeId, labels: &[String])

Source

pub fn set_labels(&self, id: NodeId, labels: &[String])

CIP-162 overwrite semantics, spelled once beside the primitives it composes: the node’s labels become exactly labels — the ones it carries but the list omits leave ([remove_labels]), then the list’s labels arrive ([add_labels]). Each half keeps its own accounting and redo, so the overwrite is their compose, not a third label-write path.

Source

pub fn set_property_node(&self, id: NodeId, key: &str, value: Value)

Source

pub fn set_property_rel(&self, id: RelId, key: &str, value: Value)

Source

pub fn merge_properties_node(&self, id: NodeId, map: &BTreeMap<String, Value>)

SET n += map: per-key merge through the set verb (an existing key keeps its position, a new one is added) — the node and relationship forms are the same loop over their set verbs.

Source

pub fn merge_properties_rel(&self, id: RelId, map: &BTreeMap<String, Value>)

The relationship form of Self::merge_properties_node.

Source

pub fn replace_properties_node(&self, id: NodeId, map: BTreeMap<String, Value>)

Source

pub fn replace_properties_rel(&self, id: RelId, map: BTreeMap<String, Value>)

Source

pub fn delete_rel(&self, id: RelId)

Source

pub fn delete_node(&self, id: NodeId, detach: bool) -> Result<()>

Source§

impl<'a> ExecGraph<'a>

Source

pub fn read(base: &'a Graph) -> Self

Schema-less read view of the committed graph. show_schema falls back to the live committed theater (under its lock); use Self::with_schema when a pinned admission snapshot is required. This is the constructor for tests and callers that never consult committed SHOW metadata.

Source

pub fn read_at(base: &'a Graph, snapshot_ts: u64) -> Self

read at an explicit snapshot timestamp; same schema-less invariant.

Source

pub fn with_schema(self, schema: &'a SchemaSnapshot) -> Self

Pin a schema snapshot on a view (combinator mirroring Self::with_cancel): ExecGraph::read_at(base, ts).with_schema(schema).

Source

pub fn write(base: &'a Graph, scratch: &'a RefCell<WriteScratch>) -> Self

Schema-less write view of the committed graph plus overlay. show_schema/validate_constraints fall back to the live committed theater, reached in two regimes: the autocommit path reaches it while holding the publication read guard, and ADR-0210 batched statements (CALL { … } IN TRANSACTIONS) reach it unguarded — pinned on the graph version but racing a concurrent schema change. A caller that needs a pinned admission adds it with Self::with_schema.

Source

pub fn with_cancel(self, cancel: Option<&'a CancelToken>) -> Self

Attach a cooperative cancellation flag to this view (ADR-0111). Construction sites that do not thread a token leave the view uncancellable, which preserves the existing behavior.

Source

pub fn with_ontology_document(self, document: Option<&'a str>) -> Self

Attach the ontology document the calling transaction sees (ADR-0121 §3, ADR-0227): the facade’s admission-time capture for auto-commit statements, the begin-time capture for explicit transactions. Per-admission state on the view, like Self::with_cancel (ADR-0111); the db.ontology.get / db.ontology.apply procedure arms read it through Self::effective_ontology_document, which overlays the write log’s pending ontology op on it. A view without one behaves as if the store holds no ontology, which preserves test/diagnostic behavior.

Source

pub fn with_transaction_clock(self, clock: TransactionClock) -> Self

Attach the explicit transaction’s begin-time clock: per-admission state like Self::with_cancel. A view without one is an autocommit statement, whose own instant is its transaction’s.

Source

pub fn stats(&self) -> QueryStats

Source

pub fn procedure(&self, name: &str) -> Option<Procedure>

Source

pub fn node_value(&self, id: NodeId) -> Value

Materialize a node as a Value for result rows and entity builtins (startNode()/endNode()). Falls back to the virtual-node side table (virtual_nodes, CIP-257) when the store/overlay lookup misses, so endpoints of synthesized visualization relationships resolve without a store backing. This is the one graph-level lookup shared by the entity builtins and the visualization rows. Unlike Self::node, which write paths use and which must keep missing on virtual ids (CIP-257 “Write behavior on virtual entities”), this read-path materialization is the only place the fallback is consulted.

Source

pub fn rel_value(&self, id: RelId) -> Value

Source

pub fn is_deleted_node(&self, id: NodeId) -> bool

Source

pub fn is_deleted_rel(&self, id: RelId) -> bool

Source

pub fn all_node_ids(&self) -> Vec<NodeId>

Every live node id, ascending: the snapshot’s ids minus the scratch’s deletions plus its creations (ADR-0173). A copy-on-write entry was read from the snapshot, so it is a snapshot id already, and a delete drops the id from created_nodes. The two sets meet only if an allocator handed out a committed id; dedup keeps that to one entry.

Source

pub fn all_rel_ids(&self) -> Vec<RelId>

Every live relationship id, ascending; built like Self::all_node_ids from deleted_rels and created_rels.

Auto Trait Implementations§

§

impl<'a> !Freeze for ExecGraph<'a>

§

impl<'a> !RefUnwindSafe for ExecGraph<'a>

§

impl<'a> !Send for ExecGraph<'a>

§

impl<'a> !Sync for ExecGraph<'a>

§

impl<'a> !UnwindSafe for ExecGraph<'a>

§

impl<'a> Forget for ExecGraph<'a>

§

impl<'a> Move for ExecGraph<'a>

§

impl<'a> Unpin for ExecGraph<'a>

§

impl<'a> UnsafeUnpin for ExecGraph<'a>
where &'a Graph: UnsafeUnpin, &'a SchemaSnapshot: UnsafeUnpin, &'a RefCell<WriteScratch>: UnsafeUnpin, &'a CancelToken: UnsafeUnpin, *const ArcInner<Atomic<u64>> is !null: UnsafeUnpin, PhantomData<ArcInner<Atomic<u64>>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<Option<Entry<(u64, Value)>>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, &'a str: UnsafeUnpin, NonZeroI32Inner: UnsafeUnpin, &'a CsvPolicy: UnsafeUnpin, PhantomData<(String, Arc<str>)>: UnsafeUnpin, PhantomData<(PathBuf, Arc<str>)>: UnsafeUnpin, PhantomData<(String, ())>: UnsafeUnpin, *const ArcInner<SeatPrefixes> is !null: UnsafeUnpin, PhantomData<ArcInner<SeatPrefixes>>: UnsafeUnpin, *const ArcInner<dyn PropStore> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn PropStore>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V