Skip to main content

RemoteStore

Trait RemoteStore 

Source
pub trait RemoteStore: Send + Sync {
    // Required methods
    fn upload(&self, hash: &[u8; 32], data: &[u8]) -> Result<(), EdgestoreError>;
    fn download(&self, hash: &[u8; 32]) -> Result<Vec<u8>, EdgestoreError>;
    fn list(&self) -> Result<Vec<[u8; 32]>, EdgestoreError>;
    fn delete(&self, hash: &[u8; 32]) -> Result<(), EdgestoreError>;
}
Expand description

Abstraction over a durable, content-addressed segment store.

Phase 4 provides FilesystemRemoteStore (Plan 04-04). S3 (S3RemoteStore) is a future-phase deliverable (D04, D05). Implementations must be Send + Sync so they can be shared across threads.

Required Methods§

Source

fn upload(&self, hash: &[u8; 32], data: &[u8]) -> Result<(), EdgestoreError>

Store segment bytes under content hash. Idempotent.

If a segment with the same hash already exists, the implementation MAY skip the write without returning an error.

Source

fn download(&self, hash: &[u8; 32]) -> Result<Vec<u8>, EdgestoreError>

Retrieve segment bytes by content hash.

Returns EdgestoreError::KeyNotFound if the hash is not present.

Source

fn list(&self) -> Result<Vec<[u8; 32]>, EdgestoreError>

List all stored segment hashes.

Source

fn delete(&self, hash: &[u8; 32]) -> Result<(), EdgestoreError>

Remove a segment by content hash. No-op if the segment is not present.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§