Skip to main content

StateAdapter

Trait StateAdapter 

Source
pub trait StateAdapter<S, J>:
    Send
    + Sync
    + 'static {
    // Required methods
    fn to_journal(&self, state: &S) -> PersistenceResult<(String, J)>;
    fn from_journal(
        &self,
        adapter_manifest: &str,
        state: J,
    ) -> PersistenceResult<S>;
}
Expand description

Converts domain state to and from its snapshot or durable-state representation.

Required Methods§

Source

fn to_journal(&self, state: &S) -> PersistenceResult<(String, J)>

Adapts one domain state and returns its durable adapter manifest.

Source

fn from_journal(&self, adapter_manifest: &str, state: J) -> PersistenceResult<S>

Adapts one stored journal state during recovery.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<T> StateAdapter<T, T> for IdentityAdapter
where T: Clone,