pub struct ObjectEngine { /* private fields */ }Expand description
Multi-bucket object store.
Implementations§
Source§impl ObjectEngine
impl ObjectEngine
pub fn new() -> Self
pub fn create_bucket(&self, name: impl Into<String>) -> Result<(), ObjectError>
pub fn drop_bucket(&self, name: &str) -> Result<(), ObjectError>
pub fn list_buckets(&self) -> Vec<String>
pub fn bucket_stats(&self, name: &str) -> Option<BucketStats>
Sourcepub fn put(
&self,
bucket: &str,
key: impl Into<String>,
data: Vec<u8>,
content_type: Option<String>,
metadata: Value,
) -> Result<ObjectMeta, ObjectError>
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.
Sourcepub fn get(
&self,
bucket: &str,
key: &str,
) -> Result<Option<(Vec<u8>, ObjectMeta)>, ObjectError>
pub fn get( &self, bucket: &str, key: &str, ) -> Result<Option<(Vec<u8>, ObjectMeta)>, ObjectError>
Fetch an object’s bytes + metadata, or None if absent.
Sourcepub fn head(
&self,
bucket: &str,
key: &str,
) -> Result<Option<ObjectMeta>, ObjectError>
pub fn head( &self, bucket: &str, key: &str, ) -> Result<Option<ObjectMeta>, ObjectError>
Fetch only an object’s metadata (HEAD), or None if absent.
Sourcepub fn delete(&self, bucket: &str, key: &str) -> Result<bool, ObjectError>
pub fn delete(&self, bucket: &str, key: &str) -> Result<bool, ObjectError>
Delete an object; returns whether it existed.
Sourcepub fn list(
&self,
bucket: &str,
prefix: &str,
limit: Option<usize>,
) -> Result<Vec<ObjectMeta>, ObjectError>
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.
pub fn snapshot(&self) -> EngineSnapshot
pub fn load_snapshot(&self, snap: EngineSnapshot)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ObjectEngine
impl !RefUnwindSafe for ObjectEngine
impl Send for ObjectEngine
impl Sync for ObjectEngine
impl Unpin for ObjectEngine
impl UnsafeUnpin for ObjectEngine
impl UnwindSafe for ObjectEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more