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§
fn put(&mut self, stage: Stage) -> Result<StageId, StoreError>
Sourcefn upsert(&mut self, stage: Stage) -> Result<StageId, StoreError>
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.
Sourcefn remove(&mut self, id: &StageId) -> Result<(), StoreError>
fn remove(&mut self, id: &StageId) -> Result<(), StoreError>
Remove a stage entirely. Returns Ok(()) whether or not the stage existed.
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§
Sourcefn get_owned(&self, id: &StageId) -> Result<Option<Stage>, StoreError>
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.
Sourcefn list_owned(&self, lifecycle: Option<&StageLifecycle>) -> Vec<Stage>
fn list_owned(&self, lifecycle: Option<&StageLifecycle>) -> Vec<Stage>
Return owned clones of all matching stages.