Skip to main content

StorageBackend

Trait StorageBackend 

Source
pub trait StorageBackend: Debug {
    // Required methods
    fn ensure(&self, spec: &StorageSpec) -> Result<(), ZigError>;
    fn listing(&self, spec: &StorageSpec) -> Result<StorageListing, ZigError>;
    fn abs_path(&self, spec: &StorageSpec) -> PathBuf;
}
Expand description

Abstraction over a storage backend. Implementations decide how to materialise a StorageSpec and how to enumerate its contents.

Required Methods§

Source

fn ensure(&self, spec: &StorageSpec) -> Result<(), ZigError>

Ensure the storage item exists and is ready for reads/writes. Called once per run before any step executes. Must be idempotent.

Source

fn listing(&self, spec: &StorageSpec) -> Result<StorageListing, ZigError>

Enumerate the current contents of the storage item. Called each time a step’s system prompt is rendered so the listing reflects files written by previous steps in the same run.

Source

fn abs_path(&self, spec: &StorageSpec) -> PathBuf

Absolute on-disk path for the storage item. This is what gets embedded in the agent’s system prompt so it can read/write with its normal file tools.

Implementors§