Skip to main content

RemoteStore

Trait RemoteStore 

Source
pub trait RemoteStore: Send + Sync {
    // Required methods
    fn fetch_raw(&self, cid: &VoidCid) -> Result<Vec<u8>>;
    fn push_raw(&self, data: &[u8]) -> Result<VoidCid>;
    fn exists(&self, cid: &VoidCid) -> Result<bool>;
    fn pin(&self, cid: &VoidCid) -> Result<()>;
}
Expand description

Remote content-addressed storage.

Object-safe — can be used as dyn RemoteStore and Arc<dyn RemoteStore>. All operations use raw bytes. Typed EncryptedBlob wrapping happens in the callers, not here.

Required Methods§

Source

fn fetch_raw(&self, cid: &VoidCid) -> Result<Vec<u8>>

Fetch raw bytes by CID.

Implementations must verify the fetched content hash matches the CID.

Source

fn push_raw(&self, data: &[u8]) -> Result<VoidCid>

Push raw bytes, returning the content CID.

Implementations must verify the returned CID matches the pushed content.

Source

fn exists(&self, cid: &VoidCid) -> Result<bool>

Check if a blob exists on the remote.

Source

fn pin(&self, cid: &VoidCid) -> Result<()>

Pin a blob to prevent remote garbage collection.

Implementors§