feature: log db status at agent bootup

buddies-main-deployment
James Prestwich 3 years ago
parent ea8bd56785
commit 7de6914863
No known key found for this signature in database
GPG Key ID: 7CC174C250AD83AD
  1. 9
      rust/optics-base/src/db/mod.rs

@ -1,6 +1,7 @@
use color_eyre::eyre::{Result, WrapErr};
use rocksdb::{Options, DB};
use std::path::Path;
use tracing::info;
/// Shared functionality surrounding use of rocksdb
pub mod persistence;
@ -14,6 +15,14 @@ pub fn from_path(db_path: &str) -> Result<DB> {
let mut path = Path::new(".").canonicalize()?;
path.extend(&[db_path]);
match path.is_dir() {
true => info!(
"Opening existing db at {path}",
path = path.to_str().unwrap()
),
false => info!("Creating db a {path}", path = path.to_str().unwrap()),
}
let mut opts = Options::default();
opts.create_if_missing(true);

Loading…
Cancel
Save