Weave documentation
Rust referencestrand-vault

strand-vault · storage

Source declarations, signatures and documentation for storage.

Reviewed implementation boundary: Vault construction does not automatically replay WAL entries. Snapshotting is a best-effort directory copy; replication mode/live settings are not implemented as runtime controls, and the capability preamble is not ACT authorization verification. See /libraries/strand-vault/overview.

Source: sigil/weave/libs/strand-vault/src/storage/mod.rs. SHA-256: 3a6fd877ee2fb74f9c95d93ccdcb97c6012aae4e78ef0f375738bc73229d4941.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

storage::filesystem

pub mod filesystem;

Source line: 8.

storage::memory

pub mod memory;

Source line: 9.

storage::rocksdb

pub mod rocksdb;

Source line: 10.

storage::Storage

Storage backend trait

#[async_trait]
pub trait Storage: Send + Sync {
    /// Get storage for a specific strand
    async fn get_strand_storage(&self, id: &StrandId) -> Result<Box<dyn StrandStorage>>;

    /// List all strand IDs in storage
    async fn list_strands(&self) -> Result<Vec<StrandId>>;

    /// Delete a strand from storage
    async fn delete_strand(&self, id: &StrandId) -> Result<()>;

    /// Get metadata storage
    async fn get_metadata_storage(&self) -> Result<Box<dyn MetadataStorage>>;

    /// Optional local filesystem path for a given strand, if applicable.
    ///
    /// Backends that are not directory-based should return None.
    fn strand_local_path(&self, _id: &StrandId) -> Option<std::path::PathBuf> ;
}

Source line: 17.

storage::StrandStorage

Storage for individual strand blocks

#[async_trait]
pub trait StrandStorage: Send + Sync {
    async fn read_block(&self, index: u64) -> Result<Option<Vec<u8>>>;
    async fn write_block(&self, index: u64, data: &[u8]) -> Result<()>;
    async fn delete_block(&self, index: u64) -> Result<()>;
    async fn truncate(&self, length: u64) -> Result<()>;
    async fn list_blocks(&self) -> Result<Vec<u64>>;
}

Source line: 40.

storage::MetadataStorage

Storage for vault metadata

#[async_trait]
pub trait MetadataStorage: Send + Sync {
    async fn get_master_key(&self) -> Result<Option<KeyPair>>;
    async fn set_master_key(&self, key: &KeyPair) -> Result<()>;

    async fn get_authorized_agents(
        &self,
    ) -> Result<Option<dashmap::DashMap<String, AgentPermissions>>>;
    async fn add_authorized_agent(&self, id: &str, perms: &AgentPermissions) -> Result<()>;
    async fn remove_authorized_agent(&self, id: &str) -> Result<()>;

    async fn get_namespace(&self) -> Result<Option<String>>;
    async fn set_namespace(&self, namespace: &str) -> Result<()>;

    /// Persisted policy identifier/config
    async fn get_policy(&self) -> Result<Option<String>>;
    async fn set_policy(&self, policy: &str) -> Result<()>;
}

Source line: 50.

storage::StorageFactory

Factory for creating storage backends

pub trait StorageFactory: Send + Sync {
    fn create(&self) -> Box<dyn Storage>;
    fn clone_factory(&self) -> Box<dyn StorageFactory>;
}

Source line: 69.

storage::parse_strand_id

Parse a strand ID from a string

pub fn parse_strand_id(s: impl AsRef<str>) -> Result<StrandId>;

Source line: 82.

storage::StoragePoolStats

Storage pooling interfaces (first slice)

#[derive(Debug, Clone, Default)]
pub struct StoragePoolStats {
pub open_strands: usize
}

Source line: 119.

storage::StoragePool

#[async_trait]
pub trait StoragePool: Send + Sync {
    async fn acquire(&self, id: &StrandId) -> Result<PooledStrandStorage>;
    fn stats(&self) -> StoragePoolStats;
}

Source line: 124.

storage::PooledStrandStorage

pub struct PooledStrandStorage {

}

Source line: 129.

storage::PooledStrandStorage::new

pub fn new(inner: Box<dyn StrandStorage>) -> Self;

Source line: 134.

storage::PooledStrandStorage::into_inner

pub fn into_inner(self) -> Box<dyn StrandStorage>;

Source line: 138.

storage::NoopStoragePool

Default no-op storage pool that just forwards to backend

pub struct NoopStoragePool {

}

Source line: 150.

storage::NoopStoragePool::new

pub fn new(backend: Arc<dyn Storage>) -> Self;

Source line: 155.

storage::LruStoragePool

Simple LRU storage pool with TTL and max-open

pub struct LruStoragePool {

}

Source line: 173.

storage::LruStoragePool::new

pub fn new(backend: Arc<dyn Storage>, max_open: usize, idle_ttl: Duration) -> Self;

Source line: 182.

On this page