pub struct ViewStore { /* private fields */ }Implementations§
Source§impl ViewStore
impl ViewStore
pub fn new() -> Self
pub fn views(&self) -> impl Iterator<Item = &ViewDef>
pub fn is_empty(&self) -> bool
pub fn has_view(&self, name: &str) -> bool
Sourcepub fn view_for_prop(&self, prop_name: &str) -> Option<&str>
pub fn view_for_prop(&self, prop_name: &str) -> Option<&str>
If prop_name is managed by any view, return that view’s name.
Sourcepub fn create_view(
&mut self,
def: ViewDef,
props: &mut ColumnStore,
topo: &Topology,
ids: &IdMap,
syms: &Interner,
labels: &[u32],
) -> Result<(), String>
pub fn create_view( &mut self, def: ViewDef, props: &mut ColumnStore, topo: &Topology, ids: &IdMap, syms: &Interner, labels: &[u32], ) -> Result<(), String>
Register a view and backfill values for all existing nodes.
§Errors
- Duplicate view name.
view_propalready claimed by another view.view_propalready present as a real node property inColumnStore.
Sourcepub fn restore_view(&mut self, def: ViewDef) -> Result<(), String>
pub fn restore_view(&mut self, def: ViewDef) -> Result<(), String>
Restore a view definition from a snapshot without collision checking or
backfilling. The snapshot’s ColumnStore already contains view values;
this method simply registers the definition so the store is aware of it.
Called only from open_with during snapshot restore. Callers must then
call rebuild_all to ensure values are correct after WAL replay.
Sourcepub fn delete_view(
&mut self,
name: &str,
props: &mut ColumnStore,
ids: &IdMap,
labels: &[u32],
syms: &Interner,
) -> Result<(), String>
pub fn delete_view( &mut self, name: &str, props: &mut ColumnStore, ids: &IdMap, labels: &[u32], syms: &Interner, ) -> Result<(), String>
Sourcepub fn on_edge_changed(
&self,
etype: u32,
src: u32,
dst: u32,
inserted: bool,
props: &mut ColumnStore,
topo: &Topology,
ids: &IdMap,
syms: &Interner,
labels: &[u32],
)
pub fn on_edge_changed( &self, etype: u32, src: u32, dst: u32, inserted: bool, props: &mut ColumnStore, topo: &Topology, ids: &IdMap, syms: &Interner, labels: &[u32], )
Called when an edge of type etype (symbol) between src and dst is
inserted (inserted=true) or deleted (inserted=false).
Covers both manual user edges and derived engine edges. The topo must already reflect the new state (edge added before this call on insert; edge removed before this call on delete) so that full-recompute paths (Avg, Min, Max) see correct neighbor sets.
Sourcepub fn on_prop_changed(
&self,
changed_node: u32,
field: &str,
props: &mut ColumnStore,
topo: &Topology,
ids: &IdMap,
syms: &Interner,
labels: &[u32],
)
pub fn on_prop_changed( &self, changed_node: u32, field: &str, props: &mut ColumnStore, topo: &Topology, ids: &IdMap, syms: &Interner, labels: &[u32], )
Called after SetProp / RemoveProp — finds NeighborAgg views that
read field from neighbors and recomputes values for all subject nodes.
Sourcepub fn init_node_views(
&self,
node: u32,
props: &mut ColumnStore,
syms: &Interner,
labels: &[u32],
)
pub fn init_node_views( &self, node: u32, props: &mut ColumnStore, syms: &Interner, labels: &[u32], )
Initialize view values for a newly inserted node.
Sets Degree, Count, and Sum views to their zero values (0 / 0.0). Avg / Min / Max are left absent — there is no sensible neutral value when no neighbors have been observed yet.
Call this BEFORE the rule engine’s on_node_changed for the new node so
that subsequent on_edge_changed calls (from derived-edge deltas) can
increment correctly from a known baseline.
Sourcepub fn rebuild_all(
&self,
props: &mut ColumnStore,
topo: &Topology,
ids: &IdMap,
syms: &Interner,
labels: &[u32],
)
pub fn rebuild_all( &self, props: &mut ColumnStore, topo: &Topology, ids: &IdMap, syms: &Interner, labels: &[u32], )
Recompute all view values from scratch. Called on open after WAL replay so values are consistent with persisted graph state.