Skip to main content

ReadHandle

Struct ReadHandle 

Source
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

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> ReadHandle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.