Rindle docs and package mapSkip to main content

View

Struct View 

Source
pub struct View {
    pub input: NodeId,
    pub schema: Arc<Schema>,
    pub with_ids: bool,
    pub root: RefCell<Arc<Entry>>,
    /* private fields */
}
Expand description

The materialization sink (ports ArrayView). Lives in the arena as Operator::View; its graph-touching halves (hydrate/view_push) are Graph methods that delegate the pure folding to [apply_change].

Fields§

§input: NodeId

Upstream operator we fetch/receive pushes from.

§schema: Arc<Schema>

Output schema of input (hierarchical; names resolved to ColId/RelId). This is also the view shape: a relationship slot is in-view iff its RelDef carries a child schema (rel_child(slot).is_some()).

§with_ids: bool

Always false for ArrayView (09 §1.2); kept for a future SolidView.

§root: RefCell<Arc<Entry>>

The synthetic root. root[""] is the top-level result; Arc-shared subtrees give reference stability.

Implementations§

Source§

impl View

Source

pub fn new( input: NodeId, schema: Schema, with_ids: bool, result_type: ResultType, ) -> View

Construct a View over input with the given hierarchical schema (which also carries the view shape). The caller (Graph::add_array_view) then hydrates it.

Source

pub fn data(&self) -> ViewData

The top-level result snapshot (data getter). Cheap Arc clone.

Source

pub fn result_type(&self) -> ResultType

Current result type.

Source

pub fn set_result_type(&self, rt: ResultType)

Set the result type (the async queryComplete resolution, 09 §3.8). Fires listeners out of band (it does not touch the txn dirty state).

Source

pub fn add_listener(&self, l: Listener) -> usize

Register a listener; fires it once immediately with the current snapshot (addListener, array-view.ts:115). Returns the index (for removal).

Source

pub fn listener_count(&self) -> usize

Number of registered listeners (test/inspection helper).

Source

pub fn mark_dirty(&self)

Mark the view dirty (a push happened). view_push (in graph.rs) calls this before folding the change.

Source

pub fn flush(&self)

flush (array-view.ts:173): if dirty, fire listeners with the snapshot, then bump the txn generation (so the next txn copy-on-writes again — the fresh-WeakSet analogue). No-op when not dirty.

Source

pub fn txn_gen(&self) -> TxnGen

The current transaction generation (used by view_push/hydrate).

Source

pub fn hydrate_from<'g>(&self, nodes: impl Iterator<Item = Node<'g>>)

Hydrate the tree from the input’s fetch stream (the caller supplies the already-fetched node iterator so the Graph borrow stays with the caller). Builds InPlace (the root is unobserved), then flushes once (array-view.ts:140-157).

Source

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

Fold one dataflow Change into the tree (array-view.ts:159-171). Transaction-scoped COW: takes the root out (so owned spine objects are uniquely held and mutate in place), applies, writes back. Does not flush — the caller flushes at the transaction boundary (the legacy source_push tests read the tree directly without flushing, which is fine: the change is applied to root synchronously).

Source

pub fn dump_col0(&self) -> Vec<(i64, Vec<i64>)>

[(col0_id, [child_col0_id, …]), …] — top rows + their children’s col-0 ids, children flattened across all relationship slots in slot order (the spike dump_view contract). Assumes col 0 is Int.

Source

pub fn dump_rows(&self) -> Vec<(Vec<i64>, Vec<Vec<i64>>)>

[(full_int_row, [child_full_int_row, …]), …] — like View::dump_col0 but every column as i64 (so an edit’s non-key value is observable).

Source

pub fn dump_col0_deep(&self) -> Vec<Col0Node>

Recursive col-0 dump: each entry’s col-0 id plus its children’s (recursively, across all relationship slots in slot order). The deep counterpart of View::dump_col0 — surfaces grandchildren, so a nested relationship (issue{comments{reactions}}) is fully observable. Assumes col 0 is Int.

Auto Trait Implementations§

§

impl !Freeze for View

§

impl !RefUnwindSafe for View

§

impl !Send for View

§

impl !Sync for View

§

impl Unpin for View

§

impl UnsafeUnpin for View

§

impl !UnwindSafe for View

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.