Skip to main content

Backend

Trait Backend 

Source
pub trait Backend: Sized {
    // Required methods
    fn get(
        &self,
        name: &str,
    ) -> impl Future<Output = Result<Option<Vec<u8>>, String>>;
    fn get_range(
        &self,
        name: &str,
        from: u64,
        len: u64,
    ) -> impl Future<Output = Result<Option<Vec<u8>>, String>>;
    fn put(
        &self,
        name: &str,
        bytes: &[u8],
    ) -> impl Future<Output = Result<(), String>>;
    fn delete(&self, name: &str) -> impl Future<Output = Result<(), String>>;
    fn list(&self) -> impl Future<Output = Result<Vec<(String, u64)>, String>>;
    fn staging(&self) -> impl Future<Output = Result<Self, String>>;
    fn rename(
        &self,
        name: &str,
        to: &Self,
    ) -> impl Future<Output = Result<(), String>>;
}
Expand description

Named bytes. A put is whole or absent: no reader sees half of one.

Required Methods§

Source

fn get( &self, name: &str, ) -> impl Future<Output = Result<Option<Vec<u8>>, String>>

Source

fn get_range( &self, name: &str, from: u64, len: u64, ) -> impl Future<Output = Result<Option<Vec<u8>>, String>>

At most len bytes from from on, fewer where the name ends sooner.

Source

fn put( &self, name: &str, bytes: &[u8], ) -> impl Future<Output = Result<(), String>>

Source

fn delete(&self, name: &str) -> impl Future<Output = Result<(), String>>

Source

fn list(&self) -> impl Future<Output = Result<Vec<(String, u64)>, String>>

Each name, with its size in bytes.

Source

fn staging(&self) -> impl Future<Output = Result<Self, String>>

An area beside these names that no other store writes and list never names.

Source

fn rename( &self, name: &str, to: &Self, ) -> impl Future<Output = Result<(), String>>

name moved from here into to in one step, over whatever to held under it.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§