pub struct ObjectStoreBucket { /* private fields */ }Implementations§
Source§impl ObjectStoreBucket
impl ObjectStoreBucket
pub fn new(store: Arc<dyn ObjectStore>, prefix: String) -> Result<Self>
Sourcepub fn with_writer_id(self, id: impl Into<String>) -> Self
pub fn with_writer_id(self, id: impl Into<String>) -> Self
Set the writer identity for this bucket connection. Stored in writer.json in the bucket to prevent a wrong server from writing to this prefix.
This is the “who am I” check. Set it to something that uniquely identifies this deployment — e.g. “web-server-1”, “prod-us-east”.
If another server tries to open the same bucket prefix with a different
writer_id, it gets Error::WrongWriter.
If not set, defaults to the machine’s hostname.
Trait Implementations§
Source§impl BucketStore for ObjectStoreBucket
impl BucketStore for ObjectStoreBucket
Source§fn prefix(&self) -> &str
fn prefix(&self) -> &str
The bucket prefix this store is scoped to (e.g. “my-app/db1”).
Each prefix has exactly one owner — see module docs.
Source§fn writer_id(&self) -> &str
fn writer_id(&self) -> &str
Identity of this writer. Stored in writer.json in the bucket.
Verified on open and every background loop iteration.
If another server tries to use this prefix, they get Error::WrongWriter.
fn put<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
data: Bytes,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Bytes>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_with_etag<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<(Bytes, String)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_with_etag<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<(Bytes, String)>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Internal: get object data and its ETag. Used to populate manifest.etag
after reading the manifest from bucket. Read more
fn list<'life0, 'life1, 'async_trait>(
&'life0 self,
prefix: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn put_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
path: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stream a local file to object storage. Avoids loading the entire file
into memory, making it safe for large database snapshots.
Source§fn get_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
dest: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<PathBuf>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_file<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
dest: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<PathBuf>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stream from object storage directly to a local file. Avoids loading
the entire object into memory. Returns the file path on success.
Source§fn put_if_match<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
data: Bytes,
etag: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put_if_match<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
key: &'life1 str,
data: Bytes,
etag: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Put data with an ETag precondition. Fails with
PreconditionFailed if the
object’s current ETag does not match etag. This enables optimistic
concurrency control for manifest writes.Source§fn put_if_not_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
data: Bytes,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn put_if_not_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
data: Bytes,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically create an object only if it does not already exist.
Returns
Ok(()) if created, Err(Error::PreconditionFailed) if already exists.
This is the key primitive for acquiring distributed locks.Auto Trait Implementations§
impl !RefUnwindSafe for ObjectStoreBucket
impl !UnwindSafe for ObjectStoreBucket
impl Forget for ObjectStoreBucket
impl Freeze for ObjectStoreBucket
impl Move for ObjectStoreBucket
impl Send for ObjectStoreBucket
impl Sync for ObjectStoreBucket
impl Unpin for ObjectStoreBucket
impl UnsafeUnpin for ObjectStoreBucket
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more