pub trait Source {
// Required methods
fn connect(
&self,
sort: Option<Sort>,
filters: Option<ConnectionFilters>,
split_edit_keys: Vec<ColId>,
) -> ConnId;
fn fetch<'g>(&'g self, conn: ConnId, req: &FetchRequest) -> RowFlow<'g>;
fn conn_sort(&self, conn: ConnId) -> Sort;
fn schema(&self) -> &Schema;
fn destroy(&self, conn: ConnId);
fn cursors_open(&self) -> i64;
fn try_push(
&self,
change: SourceChange,
push_one: &dyn Fn(&Connection, SourceChange),
strict: bool,
) -> Result<(), RindleError>;
fn take_error(&self) -> Option<RindleError>;
fn set_conn_output(&self, conn: ConnId, edge: OutEdge);
fn add_guard_value(&self, conn: ConnId, value: OwnedValue);
fn remove_guard_value(&self, conn: ConnId, value: &OwnedValue);
}Expand description
The connection + read contract a leaf backend owns locally (04 §4.7 /
05 §4.8). MemorySource implements it; the SQLite TableSource implements
the same trait, so connect/fetch/schema/destroy — and everything
downstream of the NodeStream they vend — are backend-identical.
The eager push fan-out is inherently graph-level (it drives downstream
operators by NodeId), so it lives in Graph::source_push + the source’s
MemorySource::push; the trait scopes to what a source answers from &self.
Required Methods§
Sourcefn connect(
&self,
sort: Option<Sort>,
filters: Option<ConnectionFilters>,
split_edit_keys: Vec<ColId>,
) -> ConnId
fn connect( &self, sort: Option<Sort>, filters: Option<ConnectionFilters>, split_edit_keys: Vec<ColId>, ) -> ConnId
Register a new connection (one downstream output). sort = None ⇒
unordered. Self-joins call this twice. Builds the Connection from the
(07-compiled) filter spec + split-edit keys, and asserts the ordering
includes the PK when ordered. Mirrors connect (memory-source.ts:162).
Sourcefn fetch<'g>(&'g self, conn: ConnId, req: &FetchRequest) -> RowFlow<'g>
fn fetch<'g>(&'g self, conn: ConnId, req: &FetchRequest) -> RowFlow<'g>
Lazy pull for conn: a stream of rows in (reverse-aware) sort order,
overlay-spliced, start-gated, constraint-trimmed, filtered. A source emits
rows; the SourceConn operator wraps them in leaf nodes (Graph::fetch).
Sourcefn conn_sort(&self, conn: ConnId) -> Sort
fn conn_sort(&self, conn: ConnId) -> Sort
The effective sort for a connection. This can differ from the table schema’s default/primary sort, and ordered downstream operators must use this.
Sourcefn destroy(&self, conn: ConnId)
fn destroy(&self, conn: ConnId)
Drop a connection’s downstream edge so it stops receiving pushes. Does NOT delete the backing indexes (§3.10).
Sourcefn cursors_open(&self) -> i64
fn cursors_open(&self) -> i64
Open-cursor count — 0 ⇒ no cursor is mid-iteration and the connection is
free for a write.
Sourcefn try_push(
&self,
change: SourceChange,
push_one: &dyn Fn(&Connection, SourceChange),
strict: bool,
) -> Result<(), RindleError>
fn try_push( &self, change: SourceChange, push_one: &dyn Fn(&Connection, SourceChange), strict: bool, ) -> Result<(), RindleError>
Eager fallible push: fan change to every connection (overlay live,
epoch-gated), clear the overlay, then write. push_one is the graph’s
downstream driver. When strict, a malformed change returns a typed
RindleError instead of a debug_assert. (A backend may keep a faster
infallible push as an inherent method; this is the object-safe seam the
graph drives.)
Sourcefn take_error(&self) -> Option<RindleError>
fn take_error(&self) -> Option<RindleError>
Take any error a cursor parked during the last drained fetch (05 §4.5);
None if it drained cleanly. Infallible backends always return None.
Sourcefn set_conn_output(&self, conn: ConnId, edge: OutEdge)
fn set_conn_output(&self, conn: ConnId, edge: OutEdge)
Wire a connection’s downstream output edge (mirrors input.setOutput).
Sourcefn add_guard_value(&self, conn: ConnId, value: OwnedValue)
fn add_guard_value(&self, conn: ConnId, value: OwnedValue)
Add a dynamic push-index guard value to conn (design 310 §4.1 — a family
root’s binding set growing; see ConnTable::add_guard_value). Required, not
defaulted: a decorator that forgot to forward it would leave the family root
unindexed and silently drop its deltas.
Sourcefn remove_guard_value(&self, conn: ConnId, value: &OwnedValue)
fn remove_guard_value(&self, conn: ConnId, value: &OwnedValue)
Remove one dynamic guard value added with add_guard_value.