Rindle docs and package mapSkip to main content

Cap

Struct Cap 

Source
pub struct Cap {
    pub input: NodeId,
    pub storage: StorageId,
    pub limit: u32,
    pub partition_key: Option<Vec<ColId>>,
    pub primary_key: Vec<ColId>,
    pub output: Cell<Option<OutEdge>>,
}
Expand description

Cap: unordered top-N by PK-set membership, backed by a StorageId slot.

Fields§

§input: NodeId

Upstream input (the EXISTS-child connection, unordered in production).

§storage: StorageId

Handle into the Graph storage arena holding this op’s per-partition CapState{size, pks} under encode_state_key(“cap”, …).

§limit: u32

The EXISTS_LIMIT count. 0 ⇒ yields nothing and stores no state.

§partition_key: Option<Vec<ColId>>

The partition columns (the correlation child field), or None for a single global partition.

§primary_key: Vec<ColId>

The input’s primary-key columns — the identity Cap tracks by (serializePK, cap.ts:315).

§output: Cell<Option<OutEdge>>

The single downstream edge as a port-carrying OutEdge (Cap feeds a relationship join’s child port). Wired via Graph::set_output / Graph::set_out_edge.

Implementations§

Source§

impl Cap

Source

pub fn new( input: NodeId, storage: StorageId, limit: u32, partition_key: Option<Vec<ColId>>, primary_key: Vec<ColId>, ) -> Cap

Source

pub fn evict_partition(&self, g: &Graph, constraint: &Constraint)

Delete the per-partition slot identified by constraint, if this Cap is partitioned and the constraint covers its partition key — the sibling of Take::evict_partition, called by the relationship join when a parent leaves a bounded parent view. Safe for the same reason: an un-hydrated Cap partition is re-hydrated by the join’s constrained fetch on parent re-entry, and a push to a missing partition is dropped.

This addresses the parent-left-the-view source of a zombie partition, which is the only one that reaches a related child limiter. A spine EXISTS Cap is upstream of the root Take instead, so no parent Remove ever reaches its join; that side is reclaimed by the mirror walk (Graph::evict_upstream_child_partitions), driven from the Take’s drop/displace points. See follow-ups/04-cap-partition-leak.md.

Source

pub fn fetch<'g>( &'g self, g: &'g Graph, req: &FetchRequest, ) -> Box<dyn Iterator<Item = Node<'g>> + 'g>

Lazy pull (cap.ts:87). Asserts no start/reverse. With state, fetches each tracked PK by a point-lookup; without state, hydrates.

Source

pub fn push<'g>(&'g self, g: &'g Graph, change: Change<'g>)

Eager push (cap.ts:177). Edit routes to Cap::push_edit; otherwise look up the partition’s state (drop if never hydrated) and dispatch Add / Remove / Child by PK-set membership.

Auto Trait Implementations§

§

impl !Freeze for Cap

§

impl !RefUnwindSafe for Cap

§

impl Send for Cap

§

impl !Sync for Cap

§

impl Unpin for Cap

§

impl UnsafeUnpin for Cap

§

impl UnwindSafe for Cap

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.