Skip to main content

ConformanceOracle

Struct ConformanceOracle 

Source
pub struct ConformanceOracle<V, C>
where V: Identities,
{ /* private fields */ }
Expand description

The contract’s rules over one instance’s event stream. C is the consumer’s context type; the oracle keeps the context each push was given, to compare with its completion’s.

Implementations§

Source§

impl<V, C> ConformanceOracle<V, C>
where V: Identities, C: PartialEq,

Source

pub fn new() -> ConformanceOracle<V, C>

An oracle that has seen nothing.

Source

pub fn healed(&mut self, failure: <V as Identities>::FailureId)

Report a failure the consumer healed: resolve accepted Heal for it. Abandoning needs no report; the Abandoned entry is the record.

Source

pub fn sealed(&mut self, through: Epoch<V>)

Report a seal the instance accepted as new: make_durable_through(through) answered Submitted. A request answered AlreadySealed changes nothing and need not be reported.

Source

pub fn pushed( &mut self, op: <V as Identities>::OpId, kind: OpKind<V>, length: u32, context: C, ) -> Result<(), Violation<V>>

Report an accepted push: the identity it returned, what it was, the bytes it asked to transfer – a write’s whole length, a read’s buffer – and the context it was given (a copy; the instance has the original).

§Errors

Violation::DuplicateIdentity if an earlier push returned op, Violation::WriteToEndedLineage for a write into a lineage reported ended, Violation::WriteAfterSeal for a write at or below its lineage’s seal, and Violation::WriteToAbandoned for a write into an epoch reported abandoned.

Source

pub fn pushed_gated( &mut self, op: <V as Identities>::OpId, kind: OpKind<V>, length: u32, context: C, gate: Epoch<V>, ) -> Result<(), Violation<V>>

Report an accepted push gated on gate, as Self::pushed reports one without.

§Errors

As Self::pushed.

Source

pub fn observe<B>(&mut self, entry: &Entry<V, B, C>) -> Result<(), Violation<V>>

Report a popped entry.

§Errors

The first rule the entry breaks.

Source

pub fn outstanding(&self) -> usize

How many pushed operations have not completed.

Source

pub fn finish(self) -> Result<(), Violation<V>>

Declare the stream finished: every pushed operation should have completed.

§Errors

Violation::Outstanding, naming the operations that did not.

Trait Implementations§

Source§

impl<V, C> Default for ConformanceOracle<V, C>
where V: Identities, C: PartialEq,

Source§

fn default() -> ConformanceOracle<V, C>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<V, C> !RefUnwindSafe for ConformanceOracle<V, C>

§

impl<V, C> !UnwindSafe for ConformanceOracle<V, C>

§

impl<V, C> Freeze for ConformanceOracle<V, C>

§

impl<V, C> Send for ConformanceOracle<V, C>
where HashMap<<V as Identities>::OpId, Pushed<V, C>>: Send, HashSet<<V as Identities>::OpId>: Send, HashMap<<V as Identities>::Lineage, <V as Identities>::EpochId>: Send, HashMap<<V as Identities>::OpId, Epoch<V>>: Send, HashMap<<V as Identities>::FailureId, Reported<V>>: Send, HashSet<<V as Identities>::FailureId>: Send, Option<<V as Identities>::Instant>: Send, HashMap<<V as Identities>::OpId, Ended>: Send, HashMap<<V as Identities>::Lineage, BTreeSet<<V as Identities>::EpochId>>: Send, HashSet<<V as Identities>::Lineage>: Send,

§

impl<V, C> Sync for ConformanceOracle<V, C>
where HashMap<<V as Identities>::OpId, Pushed<V, C>>: Sync, HashSet<<V as Identities>::OpId>: Sync, HashMap<<V as Identities>::Lineage, <V as Identities>::EpochId>: Sync, HashMap<<V as Identities>::OpId, Epoch<V>>: Sync, HashMap<<V as Identities>::FailureId, Reported<V>>: Sync, HashSet<<V as Identities>::FailureId>: Sync, Option<<V as Identities>::Instant>: Sync, HashMap<<V as Identities>::OpId, Ended>: Sync, HashMap<<V as Identities>::Lineage, BTreeSet<<V as Identities>::EpochId>>: Sync, HashSet<<V as Identities>::Lineage>: Sync,

§

impl<V, C> Unpin for ConformanceOracle<V, C>

§

impl<V, C> UnsafeUnpin for ConformanceOracle<V, C>

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.