pub struct ReaderSnapshot {
pub frozen: Arc<FrozenOverlay>,
pub base: Option<Arc<MappedBase>>,
pub deltas: Vec<Arc<CommitDelta>>,
/* private fields */
}Expand description
Lock-free reader snapshot: frozen overlay + optional V8 base + pending delta tail.
Obtained cheaply via crate::SharedDb::reader, which acquires the read lock
only long enough to clone the Arc fields. Subsequent query operations run
without any lock.
Memory bound: holds at most FOLD_EVERY_K − 1 CommitDelta Arcs in
its delta tail; the fold that resets the tail runs synchronously on the write path.
Fields§
§frozen: Arc<FrozenOverlay>Most-recent fold of the overlay state.
base: Option<Arc<MappedBase>>Shared mmap base (zero-copy, Arc-ref-counted). None for legacy stores.
deltas: Vec<Arc<CommitDelta>>Commits since the last fold, in arrival order. Length ≤ FOLD_EVERY_K − 1.
Implementations§
Source§impl ReaderSnapshot
impl ReaderSnapshot
Sourcepub fn mask_for_role(&self, role: &str) -> Result<NodeMask>
pub fn mask_for_role(&self, role: &str) -> Result<NodeMask>
Resolve a role name to a node visibility mask.
Coherent with Self::query_masked: both read from the same effective
state (frozen or cached materialization), so the mask is never stale
relative to the query data.
Sourcepub fn resolve_key(&self, key: &str) -> Option<u32>
pub fn resolve_key(&self, key: &str) -> Option<u32>
Resolve a node key to its dense id.
Checks the delta tail (via the cached materialization) so that nodes inserted since the last fold are visible.
Sourcepub fn query(
&self,
cypher: &str,
params: &BTreeMap<String, Value>,
) -> Result<ResultSet>
pub fn query( &self, cypher: &str, params: &BTreeMap<String, Value>, ) -> Result<ResultSet>
Execute a read-only Cypher query over the epoch snapshot.
Sourcepub fn query_masked(
&self,
cypher: &str,
params: &BTreeMap<String, Value>,
mask: &NodeMask,
) -> Result<ResultSet>
pub fn query_masked( &self, cypher: &str, params: &BTreeMap<String, Value>, mask: &NodeMask, ) -> Result<ResultSet>
Execute a read-only Cypher query with a node visibility mask.
Returns Err when cypher is a write statement (CREATE / MATCH…SET / DELETE).
Sourcepub fn node_info(&self, key: &str) -> Option<NodeInfo>
pub fn node_info(&self, key: &str) -> Option<NodeInfo>
Live node info from the epoch snapshot. None if key is absent or tombstoned.
Sourcepub fn node_edges(&self, key: &str) -> Result<Vec<EdgeInfo>>
pub fn node_edges(&self, key: &str) -> Result<Vec<EdgeInfo>>
Every directed edge incident on key. derived is always false since
the reader snapshot has no rule engine.
Unknown key → Err(GraphError::KeyNotFound).
Sourcepub fn neighborhood_masked(
&self,
key: &str,
depth: u32,
edge_types: Option<&[&str]>,
dir: Dir,
mask: &NodeMask,
) -> Option<ResultSet>
pub fn neighborhood_masked( &self, key: &str, depth: u32, edge_types: Option<&[&str]>, dir: Dir, mask: &NodeMask, ) -> Option<ResultSet>
BFS neighborhood expansion restricted to mask-visible nodes.
Hidden nodes are neither returned nor used as traversal intermediaries
(never-leak invariant). Returns None when key does not exist.
Auto Trait Implementations§
impl !Freeze for ReaderSnapshot
impl RefUnwindSafe for ReaderSnapshot
impl Send for ReaderSnapshot
impl Sync for ReaderSnapshot
impl Unpin for ReaderSnapshot
impl UnsafeUnpin for ReaderSnapshot
impl UnwindSafe for ReaderSnapshot
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.