Skip to main content

EventStream

Struct EventStream 

Source
pub struct EventStream { /* private fields */ }
Expand description

A reader over one session’s event stream, as values rather than as text.

What onevcs events TOKEN writes to stdout, handed back typed and attributed: every Envelope it yields belongs to the session it was opened for, checked rather than assumed, so a caller following several publications at once can tell whose event it is holding. Reading again yields whatever has been appended since, which is what --follow does with a loop around it.

A consumer that wants some of what a session writes opens it with an EventFilter instead, and gets the same stream with the events it did not ask for left out. Filtering belongs to the source rather than to whoever composes several of them: a monitor and a planner read the same session under different attention budgets, and neither of them should have to re-implement this.

Implementations§

Source§

impl EventStream

Source

pub fn open(session: &SessionToken) -> Result<Self>

Open the stream one session writes.

A session that has emitted nothing has no stream, and is refused by name rather than answered with an empty reader that would never say why.

Source

pub fn open_filtered( session: &SessionToken, filter: EventFilter, ) -> Result<Self>

Open the stream one session writes, reading it through a filter.

The filter arrives as a value rather than as text so that a consumer composing several sources — onepipeline follows sessions through this seam — passes the one it was configured with straight through, instead of spelling a spec for each source to parse again.

open is this with EventFilter::default, which admits everything: an unfiltered stream is the same stream it always was. A phase this session cannot produce is refused where it is named and dropped where it is not, which is the difference between a consumer having asked for something and a consumer having asked for everything.

Source

pub fn session(&self) -> &SessionToken

The session this stream belongs to.

Source

pub fn read(&mut self) -> Result<Vec<Envelope>>

The events appended since the last read, in order, that this stream’s filter admits.

Trait Implementations§

Source§

impl Debug for EventStream

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.