Skip to main content

RelayCell

Struct RelayCell 

Source
pub struct RelayCell<T, M> { /* private fields */ }
Expand description

The algebra-typed conflating relay (Phase 2, in-proc core).

Implementations§

Source§

impl<T, M> RelayCell<T, M>
where T: Clone + PartialEq + 'static, M: MergePolicy<T>,

Source

pub fn new( ctx: &Context, policy: BackpressurePolicy, ) -> Result<Self, RelayConfigError>

Build a relay over policy, validating the initial overflow against the policy’s algebra flags (analysis §4.3): Conflate requires M::CONFLATES.

Whether the current overflow choice is legal for M — a runtime guard mirroring new’s construction-time check (the overflow cell is reactive).

Source

pub fn depth(&self) -> Computed<u64>

Demand-driven reader: current window depth (Count).

Source

pub fn is_full(&self) -> Computed<bool>

Demand-driven reader: window is at/over high_water.

Source

pub fn is_empty(&self) -> Computed<bool>

Demand-driven reader: window is empty (nothing to drain).

Source

pub fn ingress(&self, ctx: &Context, op: T) -> IngressOutcome

Ingest one op. Applies the reactive overflow policy when the window is at high_water; otherwise merges the op into the hot head under M.

Source

pub fn drain(&self, ctx: &Context) -> Option<T>

Drain the coalesced window: take the hot head’s value and reset the window. Returns None for an empty window. The egress folds successive drains into its own accumulator; relay_converges guarantees that fold equals the flat fold of every ingested op, for any drain schedule.

Source

pub fn peek(&self, ctx: &Context) -> Option<T>

Peek the current coalesced window without draining.

Auto Trait Implementations§

§

impl<T, M> Freeze for RelayCell<T, M>

§

impl<T, M> RefUnwindSafe for RelayCell<T, M>

§

impl<T, M> Send for RelayCell<T, M>
where Source<Option<T>>: Send, PhantomData<M>: Send,

§

impl<T, M> Sync for RelayCell<T, M>
where Source<Option<T>>: Sync, PhantomData<M>: Sync,

§

impl<T, M> Unpin for RelayCell<T, M>

§

impl<T, M> UnsafeUnpin for RelayCell<T, M>

§

impl<T, M> UnwindSafe for RelayCell<T, M>

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 = !

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.