pub trait Backend: Sized {
type Lock;
// Required methods
fn lock(&self) -> impl Future<Output = Result<Self::Lock, String>>;
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<bool, 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<bool, String>>;
}Expand description
Named bytes. A put is whole or absent: no reader sees half of one.
Required Associated Types§
Required Methods§
Sourcefn lock(&self) -> impl Future<Output = Result<Self::Lock, String>>
fn lock(&self) -> impl Future<Output = Result<Self::Lock, String>>
The one exclusive lock over these names, shared by every store over them.
fn get( &self, name: &str, ) -> impl Future<Output = Result<Option<Vec<u8>>, String>>
Sourcefn get_range(
&self,
name: &str,
from: u64,
len: u64,
) -> 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>>
At most len bytes from from on, fewer where the name ends sooner.
fn put( &self, name: &str, bytes: &[u8], ) -> impl Future<Output = Result<(), String>>
Sourcefn delete(&self, name: &str) -> impl Future<Output = Result<bool, String>>
fn delete(&self, name: &str) -> impl Future<Output = Result<bool, String>>
False where another holder has name open, so it stays.
Sourcefn list(&self) -> impl Future<Output = Result<Vec<(String, u64)>, String>>
fn list(&self) -> impl Future<Output = Result<Vec<(String, u64)>, String>>
Each name, with its size in bytes.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".