pub enum RlsWriteCheck {
Predicate(Vec<u8>),
NoPolicyApplies,
AlreadyDecidedElsewhere,
DecidedEarlierInRequest,
SystemInternalCollection,
PendingInjection,
}Expand description
The write-policy check attached to one write operation.
Variants§
Predicate(Vec<u8>)
Compiled predicate bytes, decoded as Vec<ScanFilter> and evaluated
against each row image.
NoPolicyApplies
Injection ran and found no write policy for this identity here.
AlreadyDecidedElsewhere
Follower apply, or WAL replay after a crash.
The authoring identity is absent, so re-deciding could deny a write the leader already committed and diverge the replicas. Admits on purpose.
Only follower-apply and replay code may build this. Never build it where a live writing identity exists.
DecidedEarlierInRequest
This request already ran the policy over this exact row image, with a
live identity. That live identity separates it from
RlsWriteCheck::AlreadyDecidedElsewhere.
Only build this where the earlier decision provably covered the same image. If the op can touch a row that check did not see, it is not this.
SystemInternalCollection
A collection NodeDB maintains for itself, which no user creates and no policy attaches to — rate-limit bookkeeping, for example.
These never run injection, so they cannot claim NoPolicyApplies.
PendingInjection
Built, but injection has not run yet. Transient, Control Plane only.
If it reaches the gate, the write is DENIED — a missed injection fails loudly instead of quietly disabling the policy.
Implementations§
Source§impl RlsWriteCheck
impl RlsWriteCheck
Sourcepub fn from_injected(predicate_bytes: Vec<u8>) -> Self
pub fn from_injected(predicate_bytes: Vec<u8>) -> Self
Build the check from the policy compiler’s output.
Empty bytes become RlsWriteCheck::NoPolicyApplies, never an empty
predicate, so “no policy” cannot later read as “predicate lost”.
Call this only from the RLS injection pass.
Sourcepub fn already_decided_elsewhere() -> Self
pub fn already_decided_elsewhere() -> Self
Bypass for follower apply or WAL replay.
Never use it to silence a compile error where a live writing identity
exists — RlsWriteCheck::pending_injection fails closed there.
Sourcepub fn decided_earlier_in_request() -> Self
pub fn decided_earlier_in_request() -> Self
Bypass for rows this same request already admitted. Only when the earlier check covered the same row image.
Sourcepub fn system_internal_collection() -> Self
pub fn system_internal_collection() -> Self
Bypass for a write to one of NodeDB’s own internal collections.
Sourcepub fn pending_injection() -> Self
pub fn pending_injection() -> Self
Placeholder between plan construction and injection.
Safe wherever the right value is not yet known: it fails closed, and the dispatch boundary rejects any write plan still holding it.
Sourcepub fn decision(&self) -> WriteGateDecision<'_>
pub fn decision(&self) -> WriteGateDecision<'_>
What the Data Plane gate must do with this check.
Sourcepub fn has_predicate(&self) -> bool
pub fn has_predicate(&self) -> bool
True only when a compiled predicate is attached — “does a policy
restrict this identity here”. Not a gate decision; see
RlsWriteCheck::decision.
Sourcepub fn is_pending_injection(&self) -> bool
pub fn is_pending_injection(&self) -> bool
True while the plan has not been through injection. The dispatch boundary uses it to refuse un-injected writes.
Trait Implementations§
Source§impl Clone for RlsWriteCheck
impl Clone for RlsWriteCheck
Source§impl Debug for RlsWriteCheck
impl Debug for RlsWriteCheck
Source§impl<'de> Deserialize<'de> for RlsWriteCheck
impl<'de> Deserialize<'de> for RlsWriteCheck
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for RlsWriteCheck
Source§impl<'__msgpack_de> FromMessagePack<'__msgpack_de> for RlsWriteCheck
impl<'__msgpack_de> FromMessagePack<'__msgpack_de> for RlsWriteCheck
Source§impl PartialEq for RlsWriteCheck
impl PartialEq for RlsWriteCheck
Source§impl Serialize for RlsWriteCheck
impl Serialize for RlsWriteCheck
impl StructuralPartialEq for RlsWriteCheck
Source§impl ToMessagePack for RlsWriteCheck
impl ToMessagePack for RlsWriteCheck
Source§fn write<W: Write>(&self, writer: &mut W) -> Result<(), Error>
fn write<W: Write>(&self, writer: &mut W) -> Result<(), Error>
Source§fn write_slice<W>(values: &[Self], writer: &mut W) -> Result<(), Error>
fn write_slice<W>(values: &[Self], writer: &mut W) -> Result<(), Error>
Source§fn size_hint(&self) -> Option<TrustedSizeHint>
fn size_hint(&self) -> Option<TrustedSizeHint>
Self::write, or None when it cannot be determined cheaply. Read moreAuto Trait Implementations§
impl Freeze for RlsWriteCheck
impl RefUnwindSafe for RlsWriteCheck
impl Send for RlsWriteCheck
impl Sync for RlsWriteCheck
impl Unpin for RlsWriteCheck
impl UnsafeUnpin for RlsWriteCheck
impl UnwindSafe for RlsWriteCheck
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<T> FromMessagePackOwned for Twhere
T: for<'a> FromMessagePack<'a>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.