Skip to main content

khive_runtime/runtime/
events_disk_policy.rs

1//! The disk policy and lock directory the events sidecar shares with the main pool.
2
3use super::*;
4
5impl KhiveRuntime {
6    /// The sidecar shares main's actual policy, including programmatic overrides.
7    pub fn events_disk_guard_policy(&self) -> RuntimeResult<khive_db::EffectiveDiskGuardConfig> {
8        let pool = self.core_backend.as_ref().unwrap_or(&self.backend).pool();
9        pool.effective_disk_guard_config()
10            .map(Ok)
11            .unwrap_or_else(|| {
12                self.config
13                    .disk_guard_environment
14                    .resolve(None, None)
15                    .map_err(Into::into)
16            })
17    }
18
19    /// The sidecar shares main's lock directory. `None` means neither the main
20    /// pool nor this runtime's configuration could resolve one.
21    pub fn events_volume_lock_dir(&self) -> Option<std::path::PathBuf> {
22        self.core_backend
23            .as_ref()
24            .unwrap_or(&self.backend)
25            .pool()
26            .config()
27            .volume_lock_dir
28            .clone()
29            .or_else(|| self.config.volume_lock_dir.clone())
30    }
31}