Struct mz_persist::s3::S3BlobConfig
source · pub struct S3BlobConfig {
metrics: S3BlobMetrics,
client: Client,
bucket: String,
prefix: String,
cfg: Arc<ConfigSet>,
is_cc_active: bool,
}
Expand description
Configuration for opening an S3Blob.
Fields§
§metrics: S3BlobMetrics
§client: Client
§bucket: String
§prefix: String
§cfg: Arc<ConfigSet>
§is_cc_active: bool
Implementations§
source§impl S3BlobConfig
impl S3BlobConfig
const EXTERNAL_TESTS_S3_BUCKET: &'static str = "MZ_PERSIST_EXTERNAL_STORAGE_TEST_S3_BUCKET"
sourcepub async fn new(
bucket: String,
prefix: String,
role_arn: Option<String>,
endpoint: Option<String>,
region: Option<String>,
credentials: Option<(String, String)>,
knobs: Box<dyn BlobKnobs>,
metrics: S3BlobMetrics,
cfg: Arc<ConfigSet>,
) -> Result<Self, Error>
pub async fn new( bucket: String, prefix: String, role_arn: Option<String>, endpoint: Option<String>, region: Option<String>, credentials: Option<(String, String)>, knobs: Box<dyn BlobKnobs>, metrics: S3BlobMetrics, cfg: Arc<ConfigSet>, ) -> Result<Self, Error>
Returns a new S3BlobConfig for use in production.
Stores objects in the given bucket prepended with the (possibly empty) prefix. S3 credentials and region must be available in the process or environment.
sourcepub async fn new_for_test() -> Result<Option<Self>, Error>
pub async fn new_for_test() -> Result<Option<Self>, Error>
Returns a new S3BlobConfig for use in unit tests.
By default, persist tests that use external storage (like s3) are
no-ops, so that cargo test
does the right thing without any
configuration. To activate the tests, set the
MZ_PERSIST_EXTERNAL_STORAGE_TEST_S3_BUCKET
environment variable and
ensure you have valid AWS credentials available in a location where the
AWS Rust SDK can discovery them.
This intentionally uses the MZ_PERSIST_EXTERNAL_STORAGE_TEST_S3_BUCKET
env as the switch for test no-op-ness instead of the presence of a valid
AWS authentication configuration envs because a developers might have
valid credentials present and this isn’t an explicit enough signal from
a developer running cargo test
that it’s okay to use these
credentials. It also intentionally does not use the local drop-in s3
replacement to keep persist unit tests light.
On CI, these tests are enabled by adding the scratch-aws-access plugin
to the cargo-test
step in ci/test/pipeline.template.yml
and setting
MZ_PERSIST_EXTERNAL_STORAGE_TEST_S3_BUCKET
in
ci/test/cargo-test/mzcompose.py
.
For a Materialize developer, to opt in to these tests locally for development, follow the AWS access guide:
https://github.com/MaterializeInc/i2/blob/main/doc/aws-access.md
then running source src/persist/s3_test_env_mz.sh
. You will also have
to run aws sso login
if you haven’t recently.
Non-Materialize developers will have to set up their own auto-deleting bucket and export the same env vars that s3_test_env_mz.sh does.
Only public for use in src/benches.
sourcepub fn clone_with_new_uuid_prefix(&self) -> Self
pub fn clone_with_new_uuid_prefix(&self) -> Self
Returns a clone of Self with a new v4 uuid prefix.
Trait Implementations§
source§impl Clone for S3BlobConfig
impl Clone for S3BlobConfig
source§fn clone(&self) -> S3BlobConfig
fn clone(&self) -> S3BlobConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for S3BlobConfig
impl !RefUnwindSafe for S3BlobConfig
impl Send for S3BlobConfig
impl Sync for S3BlobConfig
impl Unpin for S3BlobConfig
impl !UnwindSafe for S3BlobConfig
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> 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::Request
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> ProgressEventTimestamp for T
impl<T> ProgressEventTimestamp for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto
.source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign
, for types that do not implement AddAssign
.