Rindle docs and package mapSkip to main content

ConnTable

Struct ConnTable 

Source
pub struct ConnTable { /* private fields */ }
Expand description

A source’s connection registry: the Connections plus a generational free-list, so a torn-down connection’s slot is RECYCLED rather than leaked under query churn (the source-side analogue of the graph arena’s node/storage reuse). Shared by both Source backends (the memory BTree leaf and the SQLite TableSource) so the reuse logic — and its stale-ConnId fail-fast — lives in exactly one place and the two backends cannot drift apart.

The push fan-out iterates borrow directly (no ConnId), so it is unaffected by the generation; a slot freed but not yet reused has output == None and is skipped by the fan-out exactly as before.

Implementations§

Source§

impl ConnTable

Source

pub fn new() -> ConnTable

Source

pub fn connect(&self, conn: Connection) -> ConnId

Register conn, reusing a freed slot if one is available — its generation was bumped at free time, so the returned ConnId is distinct from the slot’s prior tenant; otherwise grow the table with a fresh generation-0 slot.

Source

pub fn destroy(&self, conn: ConnId)

Disconnect a connection — null its output edge so the push fan-out skips it — and free its slot for reuse (bump generation + add to the free-list). Idempotent and stale-safe: a non-matching generation (a double teardown / already-freed slot) is a no-op, never a panic, since teardown must be forgiving.

Source

pub fn live_ix(&self, conn: ConnId) -> usize

The slot index for conn, fail-fasting on a stale generation (the connection analogue of Graph::node/storage). Release-checked.

Source

pub fn set_output(&self, conn: ConnId, edge: OutEdge)

Set a connection’s downstream output edge (gen-checked).

Source

pub fn sort(&self, conn: ConnId) -> Sort

A connection’s effective sort (gen-checked).

Source

pub fn borrow(&self) -> Ref<'_, Vec<Connection>>

Borrow the connection vector — for the push fan-out and per-connection reads (callers that already hold a live_ix).

Source

pub fn len(&self) -> usize

Total connection slots, including freed (recyclable) ones. With slot reuse this stays bounded by the peak live-connection count across a source’s life — it does NOT grow per teardown. (The push fan-out’s per-change cost is proportional to this, so keeping it bounded is the point of the free-list.)

Source

pub fn is_empty(&self) -> bool

Whether the table has no slots yet (clippy’s len-without-is_empty companion).

Source

pub fn live_conn_count(&self) -> usize

Number of connections with a live downstream edge (current readers). A destroyed slot has its output nulled (destroy), so this counts only live pipelines — used by Graph::remove_source to refuse removing a source a query still reads.

Source

pub fn push_candidates(&self, change: &SourceChange) -> Vec<u32>

The slots that may satisfy change — a superset by construction (designs/205-GUARDED-PUSH-FANOUT-DESIGN.md §safety). Sorted ascending and deduped, so the push fan-out visits in slot order exactly as the full-scan loop did. Takes a short immutable borrow of the index that is released before it returns, so the drain can hold the conns borrow without index contention.

Source

pub fn split_edit_keys(&self) -> Vec<ColId>

The distinct split-edit keys across all connections (refcounted union). Drives the gen_push_and_write_with_split_edit trigger check at O(distinct keys) instead of O(N·keys).

Source

pub fn has_split_edit_keys(&self) -> bool

true iff some connection lists a split-edit key — lets the edit-split path skip the value-comparison check entirely when no connection needs it.

Source

pub fn add_guard_value(&self, conn: ConnId, value: OwnedValue)

Add a dynamic guard value to conn’s push-index registration (design 310 §4.1 — a family root’s binding set growing): the connection becomes a push candidate for writes whose guard column carries value. The column is the connection’s own static PushGuard::col (the family builder registers the root with an empty-valued guard on the first parameter column). Gen-checked; only between pushes (asserted). A connection with no guard column is in the always-visited scan list already, so there is nothing to add.

Source

pub fn remove_guard_value(&self, conn: ConnId, value: &OwnedValue)

Remove one dynamic guard value previously added with add_guard_value. Gen-checked; only between pushes.

Source

pub fn push_index_size(&self) -> usize

The push index’s entry count (bucket memberships + scan slots + dynamic values) — a churn/leak probe’s size signal.

Trait Implementations§

Source§

impl Default for ConnTable

Source§

fn default() -> ConnTable

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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.