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: NodeIdUpstream input (the EXISTS-child connection, unordered in production).
storage: StorageIdHandle into the Graph storage arena holding this op’s per-partition
CapState{size, pks} under encode_state_key(“cap”, …).
limit: u32The 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
impl Cap
pub fn new( input: NodeId, storage: StorageId, limit: u32, partition_key: Option<Vec<ColId>>, primary_key: Vec<ColId>, ) -> Cap
Sourcepub fn evict_partition(&self, g: &Graph, constraint: &Constraint)
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.