Skip to main content

StateStore

Trait StateStore 

Source
pub trait StateStore: Send + Sync {
    // Required methods
    fn create_checkpoint(&self, checkpoint: Checkpoint) -> Result<bool>;
    fn save_checkpoint(&self, checkpoint: Checkpoint) -> Result<()>;
    fn load_checkpoint(&self, task_id: &str) -> Result<Option<Checkpoint>>;
    fn claim_checkpoint(
        &self,
        task_id: &str,
        cycle_index: u32,
        claim_token: &str,
        lease_expires_at_ms: u64,
        now_ms: u64,
    ) -> Result<Option<Checkpoint>>;
    fn commit_checkpoint(
        &self,
        checkpoint: Checkpoint,
        claim_token: &str,
        expected_revision: u64,
    ) -> Result<bool>;
    fn renew_checkpoint_claim(
        &self,
        task_id: &str,
        claim_token: &str,
        expected_revision: u64,
        lease_expires_at_ms: u64,
        now_ms: u64,
    ) -> Result<bool>;
    fn finalize_checkpoint(
        &self,
        checkpoint: Checkpoint,
        expected_revision: u64,
    ) -> Result<bool>;
    fn delete_checkpoint(&self, task_id: &str) -> Result<()>;
    fn acknowledge_terminal(
        &self,
        task_id: &str,
        expected_revision: u64,
    ) -> Result<bool>;
    fn list_checkpoints(&self) -> Result<Vec<String>>;
    fn state_store_spec(&self) -> Option<StateStoreSpec>;
}

Required Methods§

Source

fn create_checkpoint(&self, checkpoint: Checkpoint) -> Result<bool>

Source

fn save_checkpoint(&self, checkpoint: Checkpoint) -> Result<()>

Source

fn load_checkpoint(&self, task_id: &str) -> Result<Option<Checkpoint>>

Source

fn claim_checkpoint( &self, task_id: &str, cycle_index: u32, claim_token: &str, lease_expires_at_ms: u64, now_ms: u64, ) -> Result<Option<Checkpoint>>

Source

fn commit_checkpoint( &self, checkpoint: Checkpoint, claim_token: &str, expected_revision: u64, ) -> Result<bool>

Source

fn renew_checkpoint_claim( &self, task_id: &str, claim_token: &str, expected_revision: u64, lease_expires_at_ms: u64, now_ms: u64, ) -> Result<bool>

Source

fn finalize_checkpoint( &self, checkpoint: Checkpoint, expected_revision: u64, ) -> Result<bool>

Source

fn delete_checkpoint(&self, task_id: &str) -> Result<()>

Source

fn acknowledge_terminal( &self, task_id: &str, expected_revision: u64, ) -> Result<bool>

Source

fn list_checkpoints(&self) -> Result<Vec<String>>

Source

fn state_store_spec(&self) -> Option<StateStoreSpec>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§