OpenAgentID documentation
Source referencesRust module referenceaegis-delegate

aegis-delegate · delegation_store

Declared module signatures, types, configuration, and source documentation.

Source: aegis/aegis-delegate/src/delegation_store.rs. SHA-256: 54ccefdfa3f530fe12cd3e2c32102be1d7ff7f37b7c3c9b04ff5b04037ae25be.

This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.

delegation_store::DelegationStore

Pluggable storage backend for delegation records.

Implementations may use in-memory storage, databases, or distributed caches. All operations are async to accommodate network-backed stores.

This trait provides CRUD operations on individual delegations, separate from the tree-based structural operations in [crate::tree::DelegationTree].

#[async_trait]
pub trait DelegationStore: Send + Sync {
    /// Persist a delegation. Overwrites any existing delegation with the same ID.
    async fn store_delegation(&self, delegation: &Delegation) -> Result<(), DelegationError>;

    /// Retrieve a delegation by its unique identifier.
    ///
    /// Returns `None` if no delegation with the given ID exists.
    async fn get_delegation(&self, id: &str) -> Result<Option<Delegation>, DelegationError>;

    /// List delegations granted by a specific delegator DID with pagination.
    async fn list_by_delegator(
        &self,
        delegator_did: &str,
        pagination: Pagination,
    ) -> Result<Vec<Delegation>, DelegationError>;

    /// List delegations received by a specific delegate DID with pagination.
    async fn list_by_delegate(
        &self,
        delegate_did: &str,
        pagination: Pagination,
    ) -> Result<Vec<Delegation>, DelegationError>;

    /// Delete a delegation by ID.
    ///
    /// Returns `true` if a delegation was found and removed, `false` if no
    /// delegation with the given ID existed.
    async fn delete_delegation(&self, id: &str) -> Result<bool, DelegationError>;
}

Source line: 27.

delegation_store::InMemoryDelegationStore

In-memory delegation store backed by a RwLock<HashMap>.

Suitable for development, testing, and single-instance deployments. For production multi-node deployments, use a database-backed implementation of [DelegationStore].

pub struct InMemoryDelegationStore {

}

Source line: 66.

delegation_store::InMemoryDelegationStore::new

Creates a new empty in-memory delegation store.

pub fn new() -> Self;

Source line: 72.

On this page