Skip to main content

ObjectEngine

Struct ObjectEngine 

Source
pub struct ObjectEngine { /* private fields */ }
Expand description

Multi-bucket object store.

Implementations§

Source§

impl ObjectEngine

Source

pub fn new() -> Self

Source

pub fn create_bucket(&self, name: impl Into<String>) -> Result<(), ObjectError>

Source

pub fn drop_bucket(&self, name: &str) -> Result<(), ObjectError>

Source

pub fn list_buckets(&self) -> Vec<String>

Source

pub fn bucket_stats(&self, name: &str) -> Option<BucketStats>

Source

pub fn put( &self, bucket: &str, key: impl Into<String>, data: Vec<u8>, content_type: Option<String>, metadata: Value, ) -> Result<ObjectMeta, ObjectError>

Store (or replace) an object. Returns its metadata, including the ETag.

Source

pub fn get( &self, bucket: &str, key: &str, ) -> Result<Option<(Vec<u8>, ObjectMeta)>, ObjectError>

Fetch an object’s bytes + metadata, or None if absent.

Source

pub fn head( &self, bucket: &str, key: &str, ) -> Result<Option<ObjectMeta>, ObjectError>

Fetch only an object’s metadata (HEAD), or None if absent.

Source

pub fn delete(&self, bucket: &str, key: &str) -> Result<bool, ObjectError>

Delete an object; returns whether it existed.

Source

pub fn list( &self, bucket: &str, prefix: &str, limit: Option<usize>, ) -> Result<Vec<ObjectMeta>, ObjectError>

List object metadata in a bucket, optionally filtered by key prefix, in lexical key order, capped at limit.

Source

pub fn snapshot(&self) -> EngineSnapshot

Source

pub fn load_snapshot(&self, snap: EngineSnapshot)

Trait Implementations§

Source§

impl Default for ObjectEngine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.