#[non_exhaustive]pub struct BasinConfig {
pub default_stream_config: Option<StreamConfig>,
pub stream_cipher: Option<EncryptionAlgorithm>,
pub create_stream_on_append: bool,
pub create_stream_on_read: bool,
}Expand description
Configuration for a basin.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.default_stream_config: Option<StreamConfig>Default configuration for all streams in the basin.
See StreamConfig for defaults.
stream_cipher: Option<EncryptionAlgorithm>Encryption algorithm to apply to newly created streams in the basin.
create_stream_on_append: boolWhether to create stream on append if it doesn’t exist using default stream configuration.
Defaults to false.
create_stream_on_read: boolWhether to create stream on read if it doesn’t exist using default stream configuration.
Defaults to false.
Implementations§
Source§impl BasinConfig
impl BasinConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new BasinConfig with default settings.
Examples found in repository?
7async fn main() -> Result<(), Box<dyn std::error::Error>> {
8 let access_token =
9 std::env::var("S2_ACCESS_TOKEN").map_err(|_| "S2_ACCESS_TOKEN env var not set")?;
10 let basin_name: BasinName = std::env::var("S2_BASIN")
11 .map_err(|_| "S2_BASIN env var not set")?
12 .parse()?;
13
14 let config = S2Config::new(access_token);
15 let s2 = S2::new(config)?;
16
17 let input = CreateBasinInput::new(basin_name.clone()).with_config(
18 BasinConfig::new().with_default_stream_config(
19 StreamConfig::new().with_retention_policy(RetentionPolicy::Age(10 * 24 * 60 * 60)),
20 ),
21 );
22 let basin_info = s2.create_basin(input).await?;
23 println!("{basin_info:#?}");
24
25 let basin_config = s2.get_basin_config(basin_name).await?;
26 println!("{basin_config:#?}");
27
28 Ok(())
29}Sourcepub fn with_default_stream_config(self, config: StreamConfig) -> Self
pub fn with_default_stream_config(self, config: StreamConfig) -> Self
Set the default configuration for all streams in the basin.
Examples found in repository?
7async fn main() -> Result<(), Box<dyn std::error::Error>> {
8 let access_token =
9 std::env::var("S2_ACCESS_TOKEN").map_err(|_| "S2_ACCESS_TOKEN env var not set")?;
10 let basin_name: BasinName = std::env::var("S2_BASIN")
11 .map_err(|_| "S2_BASIN env var not set")?
12 .parse()?;
13
14 let config = S2Config::new(access_token);
15 let s2 = S2::new(config)?;
16
17 let input = CreateBasinInput::new(basin_name.clone()).with_config(
18 BasinConfig::new().with_default_stream_config(
19 StreamConfig::new().with_retention_policy(RetentionPolicy::Age(10 * 24 * 60 * 60)),
20 ),
21 );
22 let basin_info = s2.create_basin(input).await?;
23 println!("{basin_info:#?}");
24
25 let basin_config = s2.get_basin_config(basin_name).await?;
26 println!("{basin_config:#?}");
27
28 Ok(())
29}Sourcepub fn with_stream_cipher(self, stream_cipher: EncryptionAlgorithm) -> Self
pub fn with_stream_cipher(self, stream_cipher: EncryptionAlgorithm) -> Self
Set the encryption algorithm to apply to newly created streams in the basin.
Sourcepub fn with_create_stream_on_append(self, create_stream_on_append: bool) -> Self
pub fn with_create_stream_on_append(self, create_stream_on_append: bool) -> Self
Set whether to create stream on append if it doesn’t exist using default stream configuration.
Sourcepub fn with_create_stream_on_read(self, create_stream_on_read: bool) -> Self
pub fn with_create_stream_on_read(self, create_stream_on_read: bool) -> Self
Set whether to create stream on read if it doesn’t exist using default stream configuration.
Trait Implementations§
Source§impl Clone for BasinConfig
impl Clone for BasinConfig
Source§fn clone(&self) -> BasinConfig
fn clone(&self) -> BasinConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BasinConfig
impl Debug for BasinConfig
Source§impl Default for BasinConfig
impl Default for BasinConfig
Source§fn default() -> BasinConfig
fn default() -> BasinConfig
Source§impl From<BasinConfig> for BasinConfig
impl From<BasinConfig> for BasinConfig
Source§fn from(value: BasinConfig) -> Self
fn from(value: BasinConfig) -> Self
Source§impl From<BasinConfig> for BasinConfig
impl From<BasinConfig> for BasinConfig
Source§fn from(value: BasinConfig) -> Self
fn from(value: BasinConfig) -> Self
Auto Trait Implementations§
impl Freeze for BasinConfig
impl RefUnwindSafe for BasinConfig
impl Send for BasinConfig
impl Sync for BasinConfig
impl Unpin for BasinConfig
impl UnsafeUnpin for BasinConfig
impl UnwindSafe for BasinConfig
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§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