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