Skip to main content

State

Trait State 

Source
pub trait State:
    'static
    + Send
    + Sync {
    type Item: Default;

    // Required methods
    fn commit(&mut self, timestamp: &Timestamp);
    fn last_committed_timestamp(&self) -> Timestamp;
    fn at(&mut self, timestamp: &Timestamp) -> Option<&mut Self::Item>;
}
Expand description

The State trait must be implemented by the state exposed to the operators by ERDOS.

Required Associated Types§

Required Methods§

Source

fn commit(&mut self, timestamp: &Timestamp)

The commit method commits the final state for a given timestamp.

Source

fn last_committed_timestamp(&self) -> Timestamp

Retrieves the last committed timestamp by this state. This method can be used in conjunction with Self::at to retrieve the latest committed state.

Source

fn at(&mut self, timestamp: &Timestamp) -> Option<&mut Self::Item>

Retrieve the state at a given timestamp. If the state for that timestamp hasn’t been initialized yet, invoke the default method on the Self::Item type, and return the newly created state for that timestamp.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl State for ()

State implementation for () to be used by operators that are stateless.

Source§

type Item = ()

Source§

fn commit(&mut self, _timestamp: &Timestamp)

Source§

fn last_committed_timestamp(&self) -> Timestamp

Source§

fn at(&mut self, _timestamp: &Timestamp) -> Option<&mut Self::Item>

Implementors§

Source§

impl<S> State for TimeVersionedState<S>
where S: 'static + Default + Send + Sync,

Source§

type Item = S