(path: &str)
| 9 | |
| 10 | impl 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 { |
nothing calls this directly
no outgoing calls
no test coverage detected