pub struct NodeMask { /* private fields */ }Expand description
Query-scoped node visibility filter (ACL primitive).
When a NodeMask is passed to query_masked, only nodes whose dense id
appears in visible will be returned by label scans, key lookups, and
neighbor expansions. Edges where either endpoint is hidden are silently
dropped from the result.
Unknown keys in from_keys are silently ignored (they resolve to no id).
An empty mask hides every node.
Implementations§
Source§impl NodeMask
impl NodeMask
Sourcepub fn from_keys<'a, F: Fs>(
db: &GraphDb<F>,
keys: impl IntoIterator<Item = &'a str>,
) -> Self
pub fn from_keys<'a, F: Fs>( db: &GraphDb<F>, keys: impl IntoIterator<Item = &'a str>, ) -> Self
Resolve string keys to dense ids and build a mask.
Keys that do not exist in the database are ignored.
The mask mode defaults to MaskMode::Omit; call NodeMask::with_mode
to opt into MaskMode::Stub.
Sourcepub fn from_ids(ids: impl IntoIterator<Item = u32>) -> Self
pub fn from_ids(ids: impl IntoIterator<Item = u32>) -> Self
Build a mask from an already-resolved iterator of dense node ids.
Used by ReaderSnapshot handlers that resolve keys against the frozen
state without a GraphDb reference.
Sourcepub fn with_mode(self, mode: MaskMode) -> Self
pub fn with_mode(self, mode: MaskMode) -> Self
Set the rendering mode, consuming self and returning a new mask.
SECURITY: never call with MaskMode::Stub on role-token paths.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn intersect(&self, other: &NodeMask) -> NodeMask
pub fn intersect(&self, other: &NodeMask) -> NodeMask
Return a new mask that is the intersection of self and other.
The result contains only nodes visible in both masks. Used to enforce
the never-widen rule when a role token also supplies a client mask:
effective = role_mask.intersect(&client_mask).
The result always carries MaskMode::Omit — the role-path invariant
means stubs must never slip through an intersection.
Sourcepub fn contains_id(&self, id: u32) -> bool
pub fn contains_id(&self, id: u32) -> bool
Return true if the dense node id is visible in this mask.
Used by ReaderSnapshot handlers where the key has already been resolved
to a dense id (avoids a second lookup into a GraphDb).
Sourcepub fn contains_node<F: Fs>(&self, db: &GraphDb<F>, key: &str) -> bool
pub fn contains_node<F: Fs>(&self, db: &GraphDb<F>, key: &str) -> bool
Return true if the node identified by key is visible in this mask.
Returns false for keys that do not exist in the database (unknown keys
are never visible), as well as for keys that exist but are not in the
visible set. Used by node-endpoint handlers to produce the same
absent-key response for both missing and hidden nodes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NodeMask
impl RefUnwindSafe for NodeMask
impl Send for NodeMask
impl Sync for NodeMask
impl Unpin for NodeMask
impl UnsafeUnpin for NodeMask
impl UnwindSafe for NodeMask
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.