Skip to main content

StageStore

Trait StageStore 

Source
pub trait StageStore {
    // Required methods
    fn put(&mut self, stage: Stage) -> Result<StageId, StoreError>;
    fn upsert(&mut self, stage: Stage) -> Result<StageId, StoreError>;
    fn remove(&mut self, id: &StageId) -> Result<(), StoreError>;
    fn get(&self, id: &StageId) -> Result<Option<&Stage>, StoreError>;
    fn contains(&self, id: &StageId) -> bool;
    fn list(&self, lifecycle: Option<&StageLifecycle>) -> Vec<&Stage>;
    fn update_lifecycle(
        &mut self,
        id: &StageId,
        lifecycle: StageLifecycle,
    ) -> Result<(), StoreError>;
    fn stats(&self) -> StoreStats;

    // Provided methods
    fn get_owned(&self, id: &StageId) -> Result<Option<Stage>, StoreError> { ... }
    fn list_owned(&self, lifecycle: Option<&StageLifecycle>) -> Vec<Stage> { ... }
}
Expand description

Abstraction over stage storage.

Required Methods§

Source

fn put(&mut self, stage: Stage) -> Result<StageId, StoreError>

Source

fn upsert(&mut self, stage: Stage) -> Result<StageId, StoreError>

Insert a stage, replacing any existing stage with the same ID. Used to upgrade unsigned stdlib stages after signing is added.

Source

fn remove(&mut self, id: &StageId) -> Result<(), StoreError>

Remove a stage entirely. Returns Ok(()) whether or not the stage existed.

Source

fn get(&self, id: &StageId) -> Result<Option<&Stage>, StoreError>

Source

fn contains(&self, id: &StageId) -> bool

Source

fn list(&self, lifecycle: Option<&StageLifecycle>) -> Vec<&Stage>

Source

fn update_lifecycle( &mut self, id: &StageId, lifecycle: StageLifecycle, ) -> Result<(), StoreError>

Source

fn stats(&self) -> StoreStats

Provided Methods§

Source

fn get_owned(&self, id: &StageId) -> Result<Option<Stage>, StoreError>

Return an owned clone of the stage. Useful for async contexts where holding a borrow across lock boundaries is not permitted.

Source

fn list_owned(&self, lifecycle: Option<&StageLifecycle>) -> Vec<Stage>

Return owned clones of all matching stages.

Implementors§