Skip to main content

reifydb_store_column/
config.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2025 ReifyDB
3
4use std::time::Duration;
5
6use crate::backend::Backend;
7
8#[derive(Clone)]
9pub struct ColumnStoreConfig {
10	pub hot: Option<BackendConfig>,
11	pub warm: Option<BackendConfig>,
12	pub cold: Option<BackendConfig>,
13	pub retention: RetentionConfig,
14	pub compression: CompressionConfig,
15}
16
17#[derive(Clone)]
18pub struct BackendConfig {
19	pub backend: Backend,
20	pub retention_period: Duration,
21}
22
23#[derive(Clone, Debug)]
24pub struct RetentionConfig {
25	pub hot: Duration,
26	pub warm: Duration,
27	// cold is forever (no eviction)
28}
29
30#[derive(Clone, Debug)]
31pub struct CompressionConfig {
32	pub hot_compression_level: u8,  // Lighter compression for fast access
33	pub warm_compression_level: u8, // Medium compression
34	pub cold_compression_level: u8, // Heavy compression for space efficiency
35	pub enable_dictionary_compression: bool,
36	pub enable_delta_compression: bool,
37	pub enable_rle_compression: bool,
38}
39
40impl Default for ColumnStoreConfig {
41	fn default() -> Self {
42		Self {
43			hot: None,
44			warm: None,
45			cold: None,
46			retention: RetentionConfig::default(),
47			compression: CompressionConfig::default(),
48		}
49	}
50}
51
52impl Default for RetentionConfig {
53	fn default() -> Self {
54		Self {
55			hot: Duration::from_secs(1800),  // 30 minutes
56			warm: Duration::from_secs(7200), // 2 hours
57		}
58	}
59}
60
61impl Default for CompressionConfig {
62	fn default() -> Self {
63		Self {
64			hot_compression_level: 1,  // Light compression for speed
65			warm_compression_level: 3, // Balanced compression
66			cold_compression_level: 6, // Heavy compression for storage
67			enable_dictionary_compression: true,
68			enable_delta_compression: true,
69			enable_rle_compression: true,
70		}
71	}
72}