pub struct GraphMut<'a> {
pub ids: &'a IdMap,
pub syms: &'a mut Interner,
pub labels: &'a [u32],
pub props: ColumnsView<'a>,
pub topo: &'a mut Topology,
pub base_topo: Option<&'a ArchivedCsr>,
pub edge_props: &'a mut EdgeProps,
}Expand description
Borrowed mutable view of graph state the engine writes derived edges into.
Fields§
§ids: &'a IdMap§syms: &'a mut Interner§labels: &'a [u32]§props: ColumnsView<'a>§topo: &'a mut TopologyEdges written since the snapshot. Reads must go through
GraphMut::neighbors, not this field: on a store opened from a
snapshot the overlay is empty and every edge lives in base_topo.
base_topo: Option<&'a ArchivedCsr>The snapshot’s archived CSR, when one is open. None for a store with
no snapshot, where topo already holds everything.
edge_props: &'a mut EdgePropsImplementations§
Source§impl GraphMut<'_>
impl GraphMut<'_>
Sourcepub fn add_edge(&mut self, etype: u32, src: u32, dst: u32) -> bool
pub fn add_edge(&mut self, etype: u32, src: u32, dst: u32) -> bool
Add a derived edge, reporting whether it was not there before — counting the snapshot’s edges as well as the overlay’s.
Topology::add_edge looks at the overlay alone. On a store opened from
a snapshot, an edge one rule derived before the snapshot lives in the
base, so a second rule over the same edge type that desires it was told
it was new: it recorded the edge as its own beside the first rule, the
edge was counted twice, and when the second rule let go of it the edge
went from the graph while the first rule still counted it (ledger row
103). Every derived-edge insert in the engine goes through here.
A binary search of the base row and a tombstone lookup, not a merge of the row: building the merged row for each insert made re-deriving a hub’s out-edges after a snapshot quadratic in its degree.
Sourcepub fn remove_edge(&mut self, etype: u32, src: u32, dst: u32)
pub fn remove_edge(&mut self, etype: u32, src: u32, dst: u32)
Remove a derived edge, recording a tombstone only when the snapshot holds the edge.
Topology::remove_edge tombstones any edge the overlay lacks. A
retraction can name an edge the graph holds nowhere — a store in which
0.8.0 had already lost an edge one rule still owned — and a tombstone
over it is counted as a removed snapshot edge, so the edge count read
one low per such retraction until the next snapshot (ledger row 109).
Every derived-edge removal in the engine goes through here.
Sourcepub fn neighbors(&self, etype: u32, dir: Direction, v: u32) -> Cow<'_, [u32]>
pub fn neighbors(&self, etype: u32, dir: Direction, v: u32) -> Cow<'_, [u32]>
Neighbours of v over (etype, dir), merging the snapshot base with
the post-snapshot overlay and subtracting the overlay’s tombstones.
A rule that reads the graph’s shape — today only a via-hop rule, when it
expands its hop — must use this rather than topo directly. Reading the
overlay alone on a store opened from a snapshot returns nothing, which a
via-hop rule cannot distinguish from “this source reaches no via node”
and answers by retracting every edge it owns.
Auto Trait Implementations§
impl<'a> !UnwindSafe for GraphMut<'a>
impl<'a> Freeze for GraphMut<'a>
impl<'a> RefUnwindSafe for GraphMut<'a>
impl<'a> Send for GraphMut<'a>
impl<'a> Sync for GraphMut<'a>
impl<'a> Unpin for GraphMut<'a>
impl<'a> UnsafeUnpin for GraphMut<'a>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.