pub trait ObjectStore {
type Get<'a>: Future<Output = Result<Option<Object>>> + 'a
where Self: 'a;
type GetRange<'a>: Future<Output = Result<Bytes>> + 'a
where Self: 'a;
type Head<'a>: Future<Output = Result<Option<Meta>>> + 'a
where Self: 'a;
type Put<'a>: Future<Output = Result<u64>> + 'a
where Self: 'a;
type List<'a>: Future<Output = Result<Vec<Meta>>> + 'a
where Self: 'a;
type Delete<'a>: Future<Output = Result<()>> + 'a
where Self: 'a;
// Required methods
fn get<'a>(&'a self, key: &'a str) -> Self::Get<'a>;
fn get_range<'a>(
&'a self,
key: &'a str,
range: Range<u64>,
) -> Self::GetRange<'a>;
fn head<'a>(&'a self, key: &'a str) -> Self::Head<'a>;
fn put<'a>(&'a self, key: &'a str, body: Bytes, cond: Cond) -> Self::Put<'a>;
fn list<'a>(&'a self, prefix: &'a str) -> Self::List<'a>;
fn delete<'a>(&'a self, key: &'a str) -> Self::Delete<'a>;
}Expand description
An object store with generation preconditions.
Keys are validated by Key::parse: /-separated segments of
[A-Za-z0-9._-], no empty segment, none starting with ., at most 1024 bytes.
Implementations must be linearizable per key: a successful conditional write is observed by every later read.
Required Associated Types§
Required Methods§
Sourcefn get<'a>(&'a self, key: &'a str) -> Self::Get<'a>
fn get<'a>(&'a self, key: &'a str) -> Self::Get<'a>
The whole object, or None if it does not exist.
Sourcefn get_range<'a>(
&'a self,
key: &'a str,
range: Range<u64>,
) -> Self::GetRange<'a>
fn get_range<'a>( &'a self, key: &'a str, range: Range<u64>, ) -> Self::GetRange<'a>
Bytes range of the object. A range running past the end is clipped;
a range starting at or past the end is an empty body. A missing object
is Error::NotFound.
Sourcefn put<'a>(&'a self, key: &'a str, body: Bytes, cond: Cond) -> Self::Put<'a>
fn put<'a>(&'a self, key: &'a str, body: Bytes, cond: Cond) -> Self::Put<'a>
Write body under key if cond holds; returns the new generation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".