ObjectStore

Trait ObjectStore 

Source
pub trait ObjectStore {
    // Required methods
    fn put(
        &mut self,
        uri: &FabricUri,
        data: &[u8],
        opts: Option<PutOptions>,
    ) -> Result<()>;
    fn get(&self, uri: &FabricUri) -> Result<Option<ObjectData>>;
    fn head(&self, uri: &FabricUri) -> Result<Option<ObjectInfo>>;
    fn delete(&mut self, uri: &FabricUri) -> Result<bool>;
    fn list(
        &self,
        pool: &str,
        bucket: &str,
        prefix: &str,
    ) -> Result<Vec<String>>;
}
Expand description

Universal object storage trait.

Implementations provide storage backends (memory, block, tiered). All writes compute and store a CRC32 checksum; all reads verify it.

Required Methods§

Source

fn put( &mut self, uri: &FabricUri, data: &[u8], opts: Option<PutOptions>, ) -> Result<()>

Store an object at the given URI.

If the object already exists, it is overwritten. The CRC32 checksum is computed from data and stored in the object metadata.

Source

fn get(&self, uri: &FabricUri) -> Result<Option<ObjectData>>

Retrieve an object by URI.

Returns None if the object does not exist. On a successful read, the CRC32 checksum is verified against the stored value.

Source

fn head(&self, uri: &FabricUri) -> Result<Option<ObjectInfo>>

Retrieve object metadata without reading the data.

Source

fn delete(&mut self, uri: &FabricUri) -> Result<bool>

Delete an object by URI. Returns true if the object existed.

Source

fn list(&self, pool: &str, bucket: &str, prefix: &str) -> Result<Vec<String>>

List object keys matching a prefix within a bucket.

The prefix is matched against the key portion of the URI (not the full URI string). An empty prefix lists all keys in the bucket.

Implementors§