Skip to main content

JsonFileStore

Struct JsonFileStore 

Source
pub struct JsonFileStore { /* private fields */ }
Expand description

File-backed stage store. Persists to JSON on every mutation. Loads stdlib on first creation, then reads from disk on subsequent runs.

Implementations§

Source§

impl JsonFileStore

Source

pub fn open(path: impl Into<PathBuf>) -> Result<Self, StoreError>

Open or create a store at the given path. If the file exists, loads from it. Otherwise creates an empty store.

Source

pub fn len(&self) -> usize

Number of stages in the store.

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl StageStore for JsonFileStore

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

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.
Source§

fn find_by_name(&self, name: &str) -> Vec<&Stage>

Find all stages whose metadata name field matches exactly. Used by graph loaders so composition files can reference stages by their human-authored name instead of their 8-char content-hash prefix. Returns every match across all lifecycles; callers typically filter for Active.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.