Skip to main content

PackByIdResolver

Trait PackByIdResolver 

Source
pub trait PackByIdResolver: Send + Sync {
    // Required methods
    fn resolve_by_id<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Resolved>, RuntimeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_by_id<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid,
        hard: bool,
    ) -> Pin<Box<dyn Future<Output = Result<Value, RuntimeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn resolve_by_id_including_deleted<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Resolved>, RuntimeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Optional sub-trait for packs that own private SQL tables and issue UUIDs that must be reachable through the generic get(id) and delete(id) verbs.

Implementing both methods is required — the sub-trait bundles them atomically so partial implementation is a compile-time error, not a runtime surprise. Packs whose records live in the shared entity/note substrate (gtd, memory) do not implement this sub-trait.

Required Methods§

Source

fn resolve_by_id<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<Resolved>, RuntimeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Attempt to resolve a live (non-deleted) UUID owned by this pack’s private tables.

Returns Some(Resolved::PackRecord { ... }) if this pack owns the UUID, None if it does not (the caller continues to the next resolver), or Err(...) on a storage error.

Must query domain-authoritative tables before mirror tables. Must NOT filter by namespace. UUID v4 is globally unique; by-ID resolution is namespace-blind per ADR-007.

Source

fn delete_by_id<'life0, 'async_trait>( &'life0 self, id: Uuid, hard: bool, ) -> Pin<Box<dyn Future<Output = Result<Value, RuntimeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete a record owned by this pack’s private tables.

hard mirrors the delete verb’s hard? argument. Default behavior for packs with a deleted_at column MUST be soft-delete; hard=true performs permanent removal.

Returns Ok(Value) with a { deleted: true, id, kind, hard } body on success. Returns Err(RuntimeError::NotFound(...)) if the record does not exist.

Provided Methods§

Source

fn resolve_by_id_including_deleted<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<Resolved>, RuntimeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Attempt to resolve a UUID including already-soft-deleted records.

Used by the hard-delete path. Default delegates to resolve_by_id; packs with deleted_at columns override this to query without the filter.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§