pub struct ReadHandle { /* private fields */ }Expand description
A cloneable, Send + Sync handle for reads. Every clone shares the same ReadCore;
reads run on the calling thread and never touch the writer thread.
Implementations§
Source§impl ReadHandle
impl ReadHandle
Sourcepub fn read(&self, query: &Query, after: Position, limit: Option<u64>) -> Reads
pub fn read(&self, query: &Query, after: Position, limit: Option<u64>) -> Reads
Reads events matching query, ascending, strictly after after, up to the
watermark pinned now. The result is a lending iterator (it borrows its own decode
buffer per item), so consume it with while let Some(item) = reads.next().
limit caps the number of matched events yielded (None = unlimited). It is pushed
into planning, so a selective read does work proportional to limit, not to the
query’s full result. Together with after (an exclusive lower bound) it forms a
stateless pagination cursor: read a page, then read again with after set to the last
position, with no gap and no duplicate at the seam.
Sourcepub fn read_back(
&self,
query: &Query,
before: Position,
limit: Option<u64>,
) -> Reads
pub fn read_back( &self, query: &Query, before: Position, limit: Option<u64>, ) -> Reads
Reads events matching query in descending position order, strictly before
before, up to the watermark pinned now, capped at limit. The newest-first dual of
read: before is an exclusive upper bound (as after is an
exclusive lower one), so read_back(query, Position::MAX, limit) starts at the durable
tip. The result is the same lending iterator; consume it with while let Some(item) = reads.next().
limit caps the events yielded, counting from the tip down, so a newest-first page does
work proportional to limit. Together with before it is a stateless pagination
cursor: read a page, then read again with before set to the oldest position returned,
with no gap and no duplicate at the seam. Ideal for an event explorer showing recent
events first, one page at a time.
Sourcepub fn head(&self) -> Position
pub fn head(&self) -> Position
The current durable tip: the last position any read may see, as published at the most
recent commit. A single atomic load, so a caller sampling it often (a lag gauge
computing head - cursor per module) pays no planning cost. Point-in-time like a
Reads::watermark: a later read pinned here resumes with no gap.
Sourcepub fn subscribe(&self, query: Query, after: Position) -> Subscription
pub fn subscribe(&self, query: Query, after: Position) -> Subscription
Starts a Subscription over query, resuming strictly after after: it catches up
on everything already durable, then tails live events with no gap and no duplicate at
the boundary. See Subscription.
Trait Implementations§
Source§impl Clone for ReadHandle
impl Clone for ReadHandle
Source§fn clone(&self) -> ReadHandle
fn clone(&self) -> ReadHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more