AnchorBackend

Trait AnchorBackend 

Source
pub trait AnchorBackend: Send + Sync {
    // Required methods
    fn anchor<'life0, 'life1, 'async_trait>(
        &'life0 self,
        root: &'life1 Hash,
        metadata: AnchorMetadata,
    ) -> Pin<Box<dyn Future<Output = Result<AnchorReceipt, AnchorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn verify<'life0, 'life1, 'async_trait>(
        &'life0 self,
        receipt: &'life1 AnchorReceipt,
    ) -> Pin<Box<dyn Future<Output = Result<bool, AnchorError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn name(&self) -> &str;
    fn is_healthy<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for anchoring backends

Implementations should be:

  • Append-only (no deletion of anchors)
  • Tamper-evident (modifications are detectable)
  • Verifiable (anchors can be independently verified)

Required Methods§

Source

fn anchor<'life0, 'life1, 'async_trait>( &'life0 self, root: &'life1 Hash, metadata: AnchorMetadata, ) -> Pin<Box<dyn Future<Output = Result<AnchorReceipt, AnchorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Anchor a Merkle root to the external system

Returns a receipt that can be used to verify the anchor later.

Source

fn verify<'life0, 'life1, 'async_trait>( &'life0 self, receipt: &'life1 AnchorReceipt, ) -> Pin<Box<dyn Future<Output = Result<bool, AnchorError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Verify that a previously issued receipt is still valid

Returns true if the anchor exists and matches the receipt.

Source

fn name(&self) -> &str

Get the human-readable name of this backend

Source

fn is_healthy<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if the backend is available and healthy

Implementors§