pub struct S3ObjectBlockClient { /* private fields */ }Expand description
S3-compatible object storage client for block operations.
This client implements ObjectBlockOps using the AWS S3 SDK.
It supports parallel block operations and uses rayon for CPU-bound memory copies.
§Key Formatting
Uses a KeyFormatter to convert SequenceHash to object keys. The formatter
can embed rank, namespace, or other prefixes for key uniqueness across workers.
Implementations§
Source§impl S3ObjectBlockClient
impl S3ObjectBlockClient
Sourcepub async fn with_key_formatter(
config: S3Config,
key_formatter: Arc<dyn KeyFormatter>,
) -> Result<Self>
pub async fn with_key_formatter( config: S3Config, key_formatter: Arc<dyn KeyFormatter>, ) -> Result<Self>
Sourcepub fn from_client(client: Client, config: S3Config) -> Self
pub fn from_client(client: Client, config: S3Config) -> Self
Create from an existing AWS S3 client with default key formatting.
Sourcepub fn from_client_with_formatter(
client: Client,
config: S3Config,
key_formatter: Arc<dyn KeyFormatter>,
) -> Self
pub fn from_client_with_formatter( client: Client, config: S3Config, key_formatter: Arc<dyn KeyFormatter>, ) -> Self
Create from an existing AWS S3 client with a custom key formatter.
Sourcepub fn key_formatter(&self) -> &Arc<dyn KeyFormatter> ⓘ
pub fn key_formatter(&self) -> &Arc<dyn KeyFormatter> ⓘ
Get a reference to the key formatter.
Sourcepub async fn ensure_bucket_exists(&self) -> Result<()>
pub async fn ensure_bucket_exists(&self) -> Result<()>
Ensure the bucket exists, creating it if necessary.
Sourcepub async fn put_if_not_exists(&self, key: &str, data: Bytes) -> Result<bool>
pub async fn put_if_not_exists(&self, key: &str, data: Bytes) -> Result<bool>
Put an object with a conditional check (If-None-Match: *).
This performs an atomic write that only succeeds if the object does not already exist. Returns:
Ok(true)if the object was created successfullyOk(false)if the object already exists (PreconditionFailed)Err(...)for other errors
§Arguments
key- Object keydata- Object data to write
Sourcepub async fn delete_object(&self, key: &str) -> Result<bool>
pub async fn delete_object(&self, key: &str) -> Result<bool>
Sourcepub async fn has_object(&self, key: &str) -> Result<bool>
pub async fn has_object(&self, key: &str) -> Result<bool>
Sourcepub async fn put_object(&self, key: &str, data: Bytes) -> Result<()>
pub async fn put_object(&self, key: &str, data: Bytes) -> Result<()>
Put an object unconditionally (overwrite if exists).
§Arguments
key- Object keydata- Object data to write
Sourcepub fn put_blocks_with_layout(
&self,
keys: Vec<SequenceHash>,
layout: PhysicalLayout,
block_ids: Vec<BlockId>,
) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
pub fn put_blocks_with_layout( &self, keys: Vec<SequenceHash>, layout: PhysicalLayout, block_ids: Vec<BlockId>, ) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
Put blocks to object storage using a physical layout.
This is the internal implementation that workers call after resolving the logical layout handle to a physical layout.
§Arguments
keys- Sequence hashes identifying each blocklayout- Physical layout containing the block datablock_ids- Block IDs within the layout to upload
Returns a vector of results for each block:
- Ok(hash) indicates the block was successfully stored
- Err(hash) indicates the block failed to store
Sourcepub fn get_blocks_with_layout(
&self,
keys: Vec<SequenceHash>,
layout: PhysicalLayout,
block_ids: Vec<BlockId>,
) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
pub fn get_blocks_with_layout( &self, keys: Vec<SequenceHash>, layout: PhysicalLayout, block_ids: Vec<BlockId>, ) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
Get blocks from object storage into a physical layout.
This is the internal implementation that workers call after resolving the logical layout handle to a physical layout.
§Arguments
keys- Sequence hashes identifying each blocklayout- Physical layout to write the block data intoblock_ids- Block IDs within the layout to download into
Returns a vector of results for each block:
- Ok(hash) indicates the block was successfully retrieved
- Err(hash) indicates the block failed to retrieve
Sourcepub async fn get_object_with_etag(
&self,
key: &str,
) -> Result<Option<(Bytes, Option<String>)>>
pub async fn get_object_with_etag( &self, key: &str, ) -> Result<Option<(Bytes, Option<String>)>>
Get an object’s raw bytes along with its ETag.
Used for conditional updates (CAS-style operations) where the caller needs the current ETag to perform a conditional PUT.
§Returns
Ok(Some((bytes, etag)))if the object existsOk(None)if the object does not existErr(...)for other errors
Sourcepub async fn put_object_if_match(
&self,
key: &str,
data: Bytes,
etag: &str,
) -> Result<bool>
pub async fn put_object_if_match( &self, key: &str, data: Bytes, etag: &str, ) -> Result<bool>
Put an object with an ETag precondition (If-Match).
This performs a conditional write that only succeeds if the object’s current ETag matches the provided value. Used for CAS-style atomic updates.
§Returns
Ok(true)if the write succeeded (ETag matched)Ok(false)if the ETag did not match (412 PreconditionFailed — lost the race)Err(...)for other errors
Trait Implementations§
Source§impl ObjectBlockOps for S3ObjectBlockClient
impl ObjectBlockOps for S3ObjectBlockClient
Source§fn has_blocks(
&self,
keys: Vec<SequenceHash>,
) -> BoxFuture<'static, Vec<(SequenceHash, Option<usize>)>>
fn has_blocks( &self, keys: Vec<SequenceHash>, ) -> BoxFuture<'static, Vec<(SequenceHash, Option<usize>)>>
Source§fn put_blocks(
&self,
keys: Vec<SequenceHash>,
_src_layout: LogicalLayoutHandle,
_block_ids: Vec<BlockId>,
) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
fn put_blocks( &self, keys: Vec<SequenceHash>, _src_layout: LogicalLayoutHandle, _block_ids: Vec<BlockId>, ) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
Source§fn get_blocks(
&self,
keys: Vec<SequenceHash>,
_dst_layout: LogicalLayoutHandle,
_block_ids: Vec<BlockId>,
) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
fn get_blocks( &self, keys: Vec<SequenceHash>, _dst_layout: LogicalLayoutHandle, _block_ids: Vec<BlockId>, ) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
Source§fn put_blocks_with_layout(
&self,
keys: Vec<SequenceHash>,
layout: PhysicalLayout,
block_ids: Vec<BlockId>,
) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
fn put_blocks_with_layout( &self, keys: Vec<SequenceHash>, layout: PhysicalLayout, block_ids: Vec<BlockId>, ) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
Source§fn get_blocks_with_layout(
&self,
keys: Vec<SequenceHash>,
layout: PhysicalLayout,
block_ids: Vec<BlockId>,
) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
fn get_blocks_with_layout( &self, keys: Vec<SequenceHash>, layout: PhysicalLayout, block_ids: Vec<BlockId>, ) -> BoxFuture<'static, Vec<Result<SequenceHash, SequenceHash>>>
Auto Trait Implementations§
impl !RefUnwindSafe for S3ObjectBlockClient
impl !UnwindSafe for S3ObjectBlockClient
impl Freeze for S3ObjectBlockClient
impl Send for S3ObjectBlockClient
impl Sync for S3ObjectBlockClient
impl Unpin for S3ObjectBlockClient
impl UnsafeUnpin for S3ObjectBlockClient
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
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);