MCPcopy Create free account
hub / github.com/cosdata/cosdata / new

Method new

org/src/persist.rs:11–26  ·  view source on GitHub ↗
(path: &str)

Source from the content-addressed store, hash-verified

9
10impl Persist {
11 pub fn new(path: &str) -> Result<Self, WaCustomError> {
12 // Open the RocksDB database
13 let mut options = Options::default();
14 options.create_if_missing(true);
15 let result = DB::open(&options, path);
16
17 match result {
18 Ok(db) => {
19 // Initialize column families map with "main" entry
20 let cf_handles = Vec::new();
21
22 Ok(Self { db, cf_handles })
23 }
24 Err(e) => Err(WaCustomError::CreateDatabaseFailed(e.into_string())),
25 }
26 }
27
28 // Getter method for database handle
29 fn get_db(&self) -> &DB {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected