use super::index_path::IndexPath;
#[derive(Debug, Clone)]
pub struct CollectionConfig {
pub name: String,
pub index_paths: Vec<IndexPath>,
pub crdt_enabled: bool,
pub storage_mode: nodedb_physical::physical_plan::StorageMode,
pub enforcement: nodedb_physical::physical_plan::EnforcementOptions,
pub bitemporal: bool,
}
impl CollectionConfig {
pub fn new(name: &str) -> Self {
Self {
name: name.to_string(),
index_paths: Vec::new(),
crdt_enabled: false,
storage_mode: nodedb_physical::physical_plan::StorageMode::Schemaless,
enforcement: nodedb_physical::physical_plan::EnforcementOptions::default(),
bitemporal: false,
}
}
pub fn with_bitemporal(mut self, on: bool) -> Self {
self.bitemporal = on;
self
}
pub fn with_index(mut self, path: &str) -> Self {
self.index_paths.push(IndexPath::new(path));
self
}
pub fn with_crdt(mut self) -> Self {
self.crdt_enabled = true;
self
}
pub fn with_storage_mode(mut self, mode: nodedb_physical::physical_plan::StorageMode) -> Self {
self.storage_mode = mode;
self
}
}