pub struct Reader { /* private fields */ }Expand description
A reader of a SharedDataflow’s arrangements that renders nothing.
The read model’s half of §5.3’s cut: the operators that do not read the session are exactly the
ones a client with no session can be shown (crate::read). Holding one keeps the arrangements
from being released; dropping it is how a SQL connection ends.
Implementations§
Source§impl Reader
impl Reader
Sourcepub fn read(
&self,
state: &Value,
version: u64,
id: OpId,
) -> Result<Vec<Value>, ExecError>
pub fn read( &self, state: &Value, version: u64, id: OpId, ) -> Result<Vec<Value>, ExecError>
One shared operator’s output, as the rows it stands for, at version.
Advances the shared prefix first, by the same path a rendering subscriber takes — so a query issued after an ack sees that ack’s event, and a query issued when nothing is subscribed pays for the advance nobody else has paid for. That is the read model’s whole freshness story: there is no projection to lag behind.
An arrangement answers its entries in key order, which is the order the plan gives it and therefore the order the page renders in. A value answers itself, once.
Sourcepub fn len(
&self,
state: &Value,
version: u64,
id: OpId,
) -> Result<Option<u64>, ExecError>
pub fn len( &self, state: &Value, version: u64, id: OpId, ) -> Result<Option<u64>, ExecError>
How many rows one shared operator stands for, without building any of them.
Reader::read clones every entry, which is the honest cost of answering with rows. A
select count(*) does not want rows: it wants the number, and an arrangement is a
BTreeMap that already knows it. This is §3.8’s “never a recount” reaching the SQL surface —
the same fact Op::Count reads for list_len, offered to a reader that is not the plan.
None when the operator holds a value rather than an arrangement: a pointwise operator’s
collection is a Value::List it recomputed, and how many rows that stands for is a question
about the value rather than about the dataflow. The caller falls back to a scan and is no
worse off than before.