[][src]Struct transact::context::manager::sync::ContextManager

pub struct ContextManager { /* fields omitted */ }

A thread-safe ContextManager.

Methods

impl ContextManager[src]

pub fn new(
    database: Box<dyn Read<StateId = String, Key = String, Value = Vec<u8>>>
) -> Self
[src]

Constructs a new Context Manager around a given state Read.

The Read defines the state on which the context built.

pub fn get(
    &self,
    context_id: &ContextId,
    keys: &[String]
) -> Result<Vec<(String, Vec<u8>)>, ContextManagerError>
[src]

Return a set of values from a context.

The values are returned as key-value tuples

Errors

Returns an error if the context id does not exist, or an error occurs while reading from the underlying state.

pub fn set_state(
    &self,
    context_id: &ContextId,
    key: String,
    value: Vec<u8>
) -> Result<(), ContextManagerError>
[src]

Errors

Returns an error if the context id does not exist, or an error occurs while reading from the underlying state.

pub fn delete_state(
    &self,
    context_id: &ContextId,
    key: &str
) -> Result<Option<Vec<u8>>, ContextManagerError>
[src]

pub fn add_event(
    &self,
    context_id: &ContextId,
    event: Event
) -> Result<(), ContextManagerError>
[src]

pub fn add_data(
    &self,
    context_id: &ContextId,
    data: Vec<u8>
) -> Result<(), ContextManagerError>
[src]

Trait Implementations

impl ContextLifecycle for ContextManager[src]

fn create_context(
    &mut self,
    dependent_contexts: &[ContextId],
    state_id: &str
) -> ContextId
[src]

Creates a Context, and returns the resulting ContextId.

impl Clone for ContextManager[src]

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> SafeBorrow<T> for T where
    T: ?Sized

impl<'a, T> DefaultFeatures<'a> for T where
    T: 'a + Send + Sync + Clone

impl<'a, T> NonSyncFeatures<'a> for T where
    T: 'a + Clone

impl<T> Same<T> for T

type Output = T

Should always be Self