pub struct ObjectStoreClient { /* private fields */ }Expand description
Cloneable client for local and S3-compatible object storage.
Implementations§
Source§impl ObjectStoreClient
impl ObjectStoreClient
Sourcepub fn from_config(config: ObjectStoreConfig) -> ObjectStoreResult<Self>
pub fn from_config(config: ObjectStoreConfig) -> ObjectStoreResult<Self>
Creates a client from either supported configuration variant.
Sourcepub fn local(root: impl Into<PathBuf>) -> ObjectStoreResult<Self>
pub fn local(root: impl Into<PathBuf>) -> ObjectStoreResult<Self>
Creates a local filesystem store and ensures its root exists.
Sourcepub fn s3(config: S3ObjectStoreConfig) -> ObjectStoreResult<Self>
pub fn s3(config: S3ObjectStoreConfig) -> ObjectStoreResult<Self>
Creates an S3-compatible store from validated settings.
Sourcepub fn s3_with_copy_if_absent(
config: S3ObjectStoreConfig,
mode: S3CopyIfAbsentMode,
) -> ObjectStoreResult<Self>
pub fn s3_with_copy_if_absent( config: S3ObjectStoreConfig, mode: S3CopyIfAbsentMode, ) -> ObjectStoreResult<Self>
Creates an S3-compatible store with an explicit atomic-copy strategy.
Callers that publish immutable objects must select the strategy matching their provider instead of falling back to an overwriting copy.
Sourcepub fn with_max_buffered_object_size(self, limit: u64) -> Self
pub fn with_max_buffered_object_size(self, limit: u64) -> Self
Overrides the maximum size collected by Self::read_object and
Self::read_object_optional.
Sourcepub fn object_path(&self, key: &str) -> ObjectStoreResult<ObjectPath>
pub fn object_path(&self, key: &str) -> ObjectStoreResult<ObjectPath>
Validates and converts an object key to a backend path.
Sourcepub async fn write_object(
&self,
key: &str,
payload: &[u8],
) -> ObjectStoreResult<()>
pub async fn write_object( &self, key: &str, payload: &[u8], ) -> ObjectStoreResult<()>
Writes or replaces an object.
Sourcepub async fn write_bytes(
&self,
key: &str,
payload: Bytes,
) -> ObjectStoreResult<()>
pub async fn write_bytes( &self, key: &str, payload: Bytes, ) -> ObjectStoreResult<()>
Writes or replaces an object without copying an existing byte buffer.
Sourcepub async fn write_object_if_absent(
&self,
key: &str,
payload: &[u8],
) -> ObjectStoreResult<ObjectCreateOutcome>
pub async fn write_object_if_absent( &self, key: &str, payload: &[u8], ) -> ObjectStoreResult<ObjectCreateOutcome>
Atomically writes an object only when the destination does not exist.
Sourcepub async fn write_bytes_if_absent(
&self,
key: &str,
payload: Bytes,
) -> ObjectStoreResult<ObjectCreateOutcome>
pub async fn write_bytes_if_absent( &self, key: &str, payload: Bytes, ) -> ObjectStoreResult<ObjectCreateOutcome>
Atomically writes an existing byte buffer only when the destination does not exist.
Sourcepub async fn copy_object_if_absent(
&self,
source_key: &str,
destination_key: &str,
) -> ObjectStoreResult<ObjectCreateOutcome>
pub async fn copy_object_if_absent( &self, source_key: &str, destination_key: &str, ) -> ObjectStoreResult<ObjectCreateOutcome>
Atomically copies an object only when the destination does not exist.
Both Created and AlreadyPresent require the caller to verify the
destination’s expected size and digest before publishing a reference.
Sourcepub async fn head_object(&self, key: &str) -> ObjectStoreResult<ObjectMeta>
pub async fn head_object(&self, key: &str) -> ObjectStoreResult<ObjectMeta>
Returns object metadata without opening or buffering its payload.
Sourcepub async fn head_object_optional(
&self,
key: &str,
) -> ObjectStoreResult<Option<ObjectMeta>>
pub async fn head_object_optional( &self, key: &str, ) -> ObjectStoreResult<Option<ObjectMeta>>
Returns optional object metadata without opening or buffering its payload.
Sourcepub async fn read_object(&self, key: &str) -> ObjectStoreResult<Vec<u8>>
pub async fn read_object(&self, key: &str) -> ObjectStoreResult<Vec<u8>>
Reads an object or returns ObjectStoreError::NotFound.
Sourcepub async fn read_object_optional(
&self,
key: &str,
) -> ObjectStoreResult<Option<Vec<u8>>>
pub async fn read_object_optional( &self, key: &str, ) -> ObjectStoreResult<Option<Vec<u8>>>
Reads an object, returning None when it does not exist.
Sourcepub async fn read_object_with_limit(
&self,
key: &str,
limit: u64,
) -> ObjectStoreResult<Vec<u8>>
pub async fn read_object_with_limit( &self, key: &str, limit: u64, ) -> ObjectStoreResult<Vec<u8>>
Reads an object into memory with a caller-selected size limit.
Sourcepub async fn read_object_optional_with_limit(
&self,
key: &str,
limit: u64,
) -> ObjectStoreResult<Option<Vec<u8>>>
pub async fn read_object_optional_with_limit( &self, key: &str, limit: u64, ) -> ObjectStoreResult<Option<Vec<u8>>>
Reads an optional object into memory with a caller-selected size limit.
Sourcepub async fn get_object(
&self,
key: &str,
limit: u64,
) -> ObjectStoreResult<GetResult>
pub async fn get_object( &self, key: &str, limit: u64, ) -> ObjectStoreResult<GetResult>
Returns the backend read result without collecting its payload.
Consumers can stream payload directly; the backend-reported object
size is checked before the result is returned.
Sourcepub async fn get_object_optional(
&self,
key: &str,
limit: u64,
) -> ObjectStoreResult<Option<GetResult>>
pub async fn get_object_optional( &self, key: &str, limit: u64, ) -> ObjectStoreResult<Option<GetResult>>
Returns an optional backend read result without collecting its payload.
Sourcepub async fn delete_object(&self, key: &str) -> ObjectStoreResult<()>
pub async fn delete_object(&self, key: &str) -> ObjectStoreResult<()>
Deletes an object; missing objects are treated as already deleted.
Trait Implementations§
Source§impl Clone for ObjectStoreClient
impl Clone for ObjectStoreClient
Auto Trait Implementations§
impl !RefUnwindSafe for ObjectStoreClient
impl !UnwindSafe for ObjectStoreClient
impl Freeze for ObjectStoreClient
impl Send for ObjectStoreClient
impl Sync for ObjectStoreClient
impl Unpin for ObjectStoreClient
impl UnsafeUnpin for ObjectStoreClient
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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