pub struct S3RemoteStorage { /* private fields */ }Expand description
A RemoteStorageManager backed by any
S3-compatible object store.
Construct it with S3RemoteStorage::with_store, which accepts any
ObjectStore impl, for in-process tests. Use
S3RemoteStorage::from_s3_config for the production path, which builds
an AmazonS3 client from credentials, endpoint, and bucket.
Implementations§
Source§impl S3RemoteStorage
impl S3RemoteStorage
Sourcepub fn from_gcs_config(cfg: &GcsConfig) -> Result<Self, RemoteStorageError>
pub fn from_gcs_config(cfg: &GcsConfig) -> Result<Self, RemoteStorageError>
Builds a GoogleCloudStorage client from cfg and wraps it in the
generic S3RemoteStorage engine.
With no credential fields set, authentication uses Workload Identity or ADC through the metadata server. This is the keyless GKE path.
§Errors
Returns RemoteStorageError::InvalidArgument if object_store’s
builder rejects the bucket, credential, and endpoint combination. For
example, the caller supplied both a service-account path and a key, a
credential file is unreadable, or the bucket name is empty.
Source§impl S3RemoteStorage
impl S3RemoteStorage
Sourcepub const DEFAULT_MAX_INDEX_BYTES: u64
pub const DEFAULT_MAX_INDEX_BYTES: u64
Largest index read by default: Kafka’s Java ByteBuffer capacity
fits in a signed int, so an index larger than this cannot be loaded
by Kafka. The cap applies before buffering and during streaming.
Sourcepub fn with_max_index_bytes(self, max_bytes: u64) -> Self
pub fn with_max_index_bytes(self, max_bytes: u64) -> Self
Set a lower memory limit for whole index reads, including snapshots
and epoch checkpoints. Values above Self::DEFAULT_MAX_INDEX_BYTES
use that ceiling. An object above the limit returns an error; it is
never truncated. Zero permits only empty objects.
Sourcepub fn with_store(store: Arc<dyn ObjectStore>, prefix: Option<String>) -> Self
pub fn with_store(store: Arc<dyn ObjectStore>, prefix: Option<String>) -> Self
Wraps an arbitrary ObjectStore, for example
object_store::memory::InMemory for tests. Use
Self::from_s3_config for the production S3 path. Multipart
tuning falls back to the DEFAULT_MULTIPART_THRESHOLD and
DEFAULT_MULTIPART_CHUNK_SIZE constants. Call
Self::with_multipart_tuning to override them in tests.
Sourcepub fn with_worm(self, cfg: &WormConfig) -> Result<Self, RemoteStorageError>
pub fn with_worm(self, cfg: &WormConfig) -> Result<Self, RemoteStorageError>
Puts this backend into WORM archive mode.
Every copy then seals a signed, chained .manifest beside the segment,
every delete is refused, and a write_only archive refuses remote
fetches as well.
§Errors
Returns an error when the bucket policy cannot be confirmed or cfg’s
signing key cannot be loaded.
Sourcepub fn with_multipart_tuning(
self,
threshold: ByteSize,
chunk_size: ByteSize,
) -> Self
pub fn with_multipart_tuning( self, threshold: ByteSize, chunk_size: ByteSize, ) -> Self
Overrides the multipart threshold and chunk size. Returns self for
chained calls. Tests use this to force the multipart path on small
fixtures. Production usually keeps the defaults.
Sourcepub fn from_s3_config(cfg: &S3Config) -> Result<Self, RemoteStorageError>
pub fn from_s3_config(cfg: &S3Config) -> Result<Self, RemoteStorageError>
Builds an AmazonS3 client from cfg and wraps it.
§Errors
Returns RemoteStorageError::InvalidArgument if object_store’s
builder rejects the bucket, region, and endpoint combination.
Trait Implementations§
Source§impl Debug for S3RemoteStorage
impl Debug for S3RemoteStorage
Source§impl RemoteStorageManager for S3RemoteStorage
impl RemoteStorageManager for S3RemoteStorage
Source§fn copy_log_segment_data(
&self,
metadata: &RemoteLogSegmentMetadata,
data: &LogSegmentData,
) -> Result<Option<CustomMetadata>, RemoteStorageError>
fn copy_log_segment_data( &self, metadata: &RemoteLogSegmentMetadata, data: &LogSegmentData, ) -> Result<Option<CustomMetadata>, RemoteStorageError>
Source§fn fetch_log_segment(
&self,
metadata: &RemoteLogSegmentMetadata,
start_position: u32,
end_position: Option<u32>,
) -> Result<Vec<u8>, RemoteStorageError>
fn fetch_log_segment( &self, metadata: &RemoteLogSegmentMetadata, start_position: u32, end_position: Option<u32>, ) -> Result<Vec<u8>, RemoteStorageError>
.log data. Read moreSource§fn fetch_index(
&self,
metadata: &RemoteLogSegmentMetadata,
index_type: IndexType,
) -> Result<Vec<u8>, RemoteStorageError>
fn fetch_index( &self, metadata: &RemoteLogSegmentMetadata, index_type: IndexType, ) -> Result<Vec<u8>, RemoteStorageError>
Source§fn delete_log_segment_data(
&self,
metadata: &RemoteLogSegmentMetadata,
) -> Result<(), RemoteStorageError>
fn delete_log_segment_data( &self, metadata: &RemoteLogSegmentMetadata, ) -> Result<(), RemoteStorageError>
Auto Trait Implementations§
impl !RefUnwindSafe for S3RemoteStorage
impl !UnwindSafe for S3RemoteStorage
impl Freeze for S3RemoteStorage
impl Send for S3RemoteStorage
impl Sync for S3RemoteStorage
impl Unpin for S3RemoteStorage
impl UnsafeUnpin for S3RemoteStorage
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<F> FnGhost for F
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§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();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§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();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§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();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§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();§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.
§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);