rs2_stream/
stream_configuration.rs1#[derive(Debug, Clone)]
5pub struct BufferConfig {
6 pub initial_capacity: usize,
7 pub max_capacity: Option<usize>,
8 pub growth_strategy: GrowthStrategy,
9}
10
11#[derive(Debug, Clone)]
12pub enum GrowthStrategy {
13 Linear(usize),
14 Exponential(f64),
15 Fixed,
16}
17
18impl Default for BufferConfig {
19 fn default() -> Self {
20 Self {
21 initial_capacity: 1024,
22 max_capacity: Some(1024 * 1024), growth_strategy: GrowthStrategy::Exponential(2.0),
24 }
25 }
26}
27
28#[derive(Debug, Clone)]
30pub struct FileConfig {
31 pub buffer_size: usize,
32 pub read_ahead: bool,
33 pub sync_on_write: bool,
34 pub compression: Option<CompressionType>,
35}
36
37#[derive(Debug, Clone)]
38pub enum CompressionType {
39 Gzip,
40 Deflate,
41 Lz4,
42}
43
44impl Default for FileConfig {
45 fn default() -> Self {
46 Self {
47 buffer_size: 8192,
48 read_ahead: true,
49 sync_on_write: false,
50 compression: None,
51 }
52 }
53}
54
55#[derive(Debug, Clone)]
57pub struct MetricsConfig {
58 pub enabled: bool,
59 pub sample_rate: f64,
60 pub labels: Vec<(String, String)>,
61}
62
63impl Default for MetricsConfig {
64 fn default() -> Self {
65 Self {
66 enabled: true,
67 sample_rate: 1.0,
68 labels: Vec::new(),
69 }
70 }
71}