Skip to main content

reifydb_store_multi/
config.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2025 ReifyDB
3
4use std::time::Duration;
5
6use reifydb_core::event::EventBus;
7use reifydb_runtime::{actor::system::ActorSystem, context::clock::Clock};
8
9use crate::hot::storage::HotStorage;
10
11#[derive(Clone)]
12pub struct MultiStoreConfig {
13	pub hot: Option<HotConfig>,
14	pub warm: Option<WarmConfig>,
15	pub cold: Option<ColdConfig>,
16	pub retention: RetentionConfig,
17	pub merge_config: MergeConfig,
18	pub event_bus: EventBus,
19	pub actor_system: ActorSystem,
20	pub clock: Clock,
21}
22
23#[derive(Clone)]
24pub struct HotConfig {
25	pub storage: HotStorage,
26}
27
28/// Warm tier configuration.
29///
30/// Placeholder for future warm tier configuration.
31#[derive(Clone, Default)]
32pub struct WarmConfig;
33
34/// Cold tier configuration.
35///
36/// Placeholder for future cold tier configuration.
37#[derive(Clone, Default)]
38pub struct ColdConfig;
39
40#[derive(Clone, Debug)]
41pub struct RetentionConfig {
42	pub hot: Duration,
43	pub warm: Duration,
44	// cold is forever (no eviction)
45}
46
47#[derive(Clone, Debug)]
48pub struct MergeConfig {
49	pub merge_threshold_rows: usize,
50	pub merge_batch_size: usize,
51	pub enable_auto_eviction: bool,
52}
53
54impl Default for RetentionConfig {
55	fn default() -> Self {
56		Self {
57			hot: Duration::from_secs(300),   // 5 minutes
58			warm: Duration::from_secs(3600), // 1 hour
59		}
60	}
61}
62
63impl Default for MergeConfig {
64	fn default() -> Self {
65		Self {
66			merge_threshold_rows: 100_000,
67			merge_batch_size: 10_000,
68			enable_auto_eviction: true,
69		}
70	}
71}