1use std::time::Duration;
2
3use common::ObjectStoreConfig;
4use serde::{Deserialize, Serialize};
5use serde_with::{DurationMilliSeconds, serde_as};
6
7use crate::model::CompressionType;
8
9#[serde_as]
14#[derive(Debug, Clone, Serialize, Deserialize)]
15pub struct ProducerConfig {
16 pub object_store: ObjectStoreConfig,
18
19 #[serde(default = "default_data_path_prefix")]
23 pub data_path_prefix: String,
24
25 #[serde(default = "default_manifest_path")]
29 pub manifest_path: String,
30
31 #[serde_as(as = "DurationMilliSeconds<u64>")]
35 #[serde(default = "default_flush_interval")]
36 pub flush_interval: Duration,
37
38 #[serde(default = "default_flush_size_bytes")]
42 pub flush_size_bytes: usize,
43
44 #[serde(default = "default_max_buffered_inputs")]
49 pub max_buffered_inputs: usize,
50
51 #[serde(default)]
55 pub batch_compression: CompressionType,
56}
57
58#[serde_as]
62#[derive(Debug, Clone, Serialize, Deserialize)]
63pub struct ConsumerConfig {
64 pub object_store: ObjectStoreConfig,
66
67 #[serde(default = "default_manifest_path")]
71 pub manifest_path: String,
72
73 #[serde(default = "default_data_path_prefix")]
77 pub data_path_prefix: String,
78
79 #[serde_as(as = "DurationMilliSeconds<u64>")]
83 #[serde(default = "default_gc_interval")]
84 pub gc_interval: Duration,
85
86 #[serde_as(as = "DurationMilliSeconds<u64>")]
91 #[serde(default = "default_gc_grace_period")]
92 pub gc_grace_period: Duration,
93}
94
95fn default_data_path_prefix() -> String {
96 "ingest".to_string()
97}
98
99fn default_manifest_path() -> String {
100 "ingest/manifest".to_string()
101}
102
103fn default_flush_interval() -> Duration {
104 Duration::from_millis(100)
105}
106
107fn default_flush_size_bytes() -> usize {
108 64 * 1024 * 1024
109}
110
111fn default_max_buffered_inputs() -> usize {
112 1000
113}
114fn default_gc_interval() -> Duration {
115 Duration::from_mins(5)
116}
117
118fn default_gc_grace_period() -> Duration {
119 Duration::from_mins(10)
120}