pub struct OverlayState { /* private fields */ }Expand description
Mutable overlay state for sync replay and query freshness.
All collections are private so the by_source/by_target adjacency indexes
cannot desync from added_edges: callers mutate exclusively through
push_edge, remove_edge,
tombstone_edge, tombstone_node,
clear, and the from_edges constructor,
each of which keeps the indexes consistent.
Implementations§
Source§impl OverlayState
impl OverlayState
Sourcepub fn from_edges(edges: impl IntoIterator<Item = OverlayEdge>) -> Self
pub fn from_edges(edges: impl IntoIterator<Item = OverlayEdge>) -> Self
Builds an overlay from a sequence of inserted edges, with the adjacency indexes constructed once up front.
§Performance
This function is O(a log a) for a edges.
Sourcepub fn added_edges(&self) -> &[OverlayEdge]
pub fn added_edges(&self) -> &[OverlayEdge]
Sourcepub const fn overlay_edge_count(&self) -> usize
pub const fn overlay_edge_count(&self) -> usize
Sourcepub fn tombstoned_edge_count(&self) -> usize
pub fn tombstoned_edge_count(&self) -> usize
Sourcepub fn tombstoned_node_count(&self) -> usize
pub fn tombstoned_node_count(&self) -> usize
Sourcepub fn tombstone_edge(&mut self, edge_id: u32)
pub fn tombstone_edge(&mut self, edge_id: u32)
Sourcepub fn tombstone_node(&mut self, node_id: u32)
pub fn tombstone_node(&mut self, node_id: u32)
Sourcepub fn has_edge_tombstones(&self) -> bool
pub fn has_edge_tombstones(&self) -> bool
Returns whether any base edge tombstones are recorded.
Sourcepub fn has_node_tombstones(&self) -> bool
pub fn has_node_tombstones(&self) -> bool
Returns whether any node tombstones are recorded.
Sourcepub fn edge_visible(&self, edge_id: u32) -> bool
pub fn edge_visible(&self, edge_id: u32) -> bool
Returns whether an edge id is visible to traversal.
§Performance
This method is O(log t) for t tombstoned edge ids.
Sourcepub fn node_visible(&self, node_id: u32) -> bool
pub fn node_visible(&self, node_id: u32) -> bool
Returns whether a node id is visible to traversal.
§Performance
This method is O(log t) for t tombstoned node ids.
Sourcepub fn push_edge(&mut self, edge: OverlayEdge)
pub fn push_edge(&mut self, edge: OverlayEdge)
Records an overlay edge and updates adjacency indexes.
§Performance
This method is O(log s + log t) for index map sizes s and t.
Sourcepub fn overlay_targets(&self, source: u32) -> &[u32]
pub fn overlay_targets(&self, source: u32) -> &[u32]
Returns overlay outgoing targets for source (empty when none).
§Performance
This method is O(log s) for s indexed sources.
Sourcepub fn overlay_sources(&self, target: u32) -> &[u32]
pub fn overlay_sources(&self, target: u32) -> &[u32]
Returns overlay incoming sources for target (empty when none).
§Performance
This method is O(log t) for t indexed targets.
Sourcepub fn remove_edge(&mut self, source: u32, target: u32)
pub fn remove_edge(&mut self, source: u32, target: u32)
Removes one overlay edge and rebuilds adjacency indexes.
§Performance
This method is O(a) for a overlay edges.
Trait Implementations§
Source§impl Clone for OverlayState
impl Clone for OverlayState
Source§fn clone(&self) -> OverlayState
fn clone(&self) -> OverlayState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OverlayState
impl Debug for OverlayState
Source§impl Default for OverlayState
impl Default for OverlayState
Source§fn default() -> OverlayState
fn default() -> OverlayState
Source§impl PartialEq for OverlayState
impl PartialEq for OverlayState
Source§fn eq(&self, other: &OverlayState) -> bool
fn eq(&self, other: &OverlayState) -> bool
self and other values to be equal, and is used by ==.