khive_runtime/
code_map_runtime.rs1use khive_db::StorageBackend;
4
5use crate::{KhiveRuntime, RuntimeConfig, RuntimeError, RuntimeResult};
6
7impl KhiveRuntime {
8 pub fn new_code_map(
15 mut config: RuntimeConfig,
16 protected_main: Vec<std::path::PathBuf>,
17 protected_events: Vec<std::path::PathBuf>,
18 ) -> RuntimeResult<Self> {
19 if config.db_path.is_none() {
20 return Err(RuntimeError::InvalidInput(
21 "code-map runtime requires a guarded file-backed database".into(),
22 ));
23 }
24 let disk_guard = config
25 .resolve_disk_guard_policy(false)?
26 .expect("code-map has a file-backed disk policy");
27 let volume_lock_dir = config.volume_lock_dir.clone();
28 Self::new_with_file_backend(config, false, move |path| {
29 StorageBackend::sqlite_code_map_with_policies(
30 path,
31 &protected_main,
32 &protected_events,
33 disk_guard,
34 khive_db::require_volume_lock_dir(volume_lock_dir)?,
35 )
36 })
37 }
38}