#[non_exhaustive]pub struct SegmentConfig {
pub flush_policy: FlushPolicy,
pub max_size_bytes: u64,
pub compression_level: i32,
pub durability: DurabilityPolicy,
pub cipher: Option<Arc<dyn SegmentCipher + Send + Sync>>,
}Expand description
Configuration knobs for SegmentBuffer.
This struct is #[non_exhaustive]: new fields may be added in any release
without breaking semver. Construct via SegmentConfig::builder() and then
mutate the public fields you care about, or use SegmentConfig::default()
directly:
use segment_buffer::SegmentConfig;
let mut config = SegmentConfig::default();
config.max_size_bytes = 1024 * 1024;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.flush_policy: FlushPolicyWhen to auto-flush pending items. See FlushPolicy for the options.
max_size_bytes: u64Max total disk usage before the buffer reports overload pressure (default: 10 GB).
compression_level: i32zstd compression level (1-22; 3 is fast with a good ratio).
durability: DurabilityPolicyPer-flush fsync behavior. See DurabilityPolicy for the three
policies and their crash-loss tradeoffs. Default is
DurabilityPolicy::Segment (today’s behavior) for backward
compatibility; cloud-sync deployments should switch to
DurabilityPolicy::Throughput once the cloud endpoint holds the
durable copy.
cipher: Option<Arc<dyn SegmentCipher + Send + Sync>>Optional cipher for encrypting segment files at rest. When None,
segments are written as plaintext zstd+CBOR. Held as an Arc so a
SegmentConfig is Clone and the same cipher can be shared
across multiple buffers or cloned into a recommended_cipher() helper.
Implementations§
Source§impl SegmentConfig
impl SegmentConfig
Sourcepub fn builder() -> SegmentConfigBuilder
pub fn builder() -> SegmentConfigBuilder
Begin a builder. Every field starts at SegmentConfig::default;
chain setter calls to override the ones you care about.
Trait Implementations§
Source§impl Clone for SegmentConfig
impl Clone for SegmentConfig
Source§fn clone(&self) -> SegmentConfig
fn clone(&self) -> SegmentConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more