small fixes

This commit is contained in:
Alex 2022-06-03 14:00:13 +02:00
parent 3d18c9e183
commit d3d7df098b
Signed by: lx
GPG key ID: 0E496D15096376BE
2 changed files with 3 additions and 6 deletions

View file

@ -26,9 +26,7 @@ impl BlockRc {
Some(x) => { Some(x) => {
tx.insert(&self.rc, &hash, x)?; tx.insert(&self.rc, &hash, x)?;
} }
None => { None => unreachable!(),
tx.remove(&self.rc, &hash)?;
}
}; };
tx.commit(old_rc) tx.commit(old_rc)
})?; })?;

View file

@ -32,9 +32,9 @@ pub async fn run_server(config_file: PathBuf) -> Result<(), Error> {
let config = read_config(config_file).expect("Unable to read config file"); let config = read_config(config_file).expect("Unable to read config file");
info!("Opening database..."); info!("Opening database...");
let mut db_path = config.metadata_dir.clone();
let db = match config.db_engine.as_str() { let db = match config.db_engine.as_str() {
"sled" => { "sled" => {
let mut db_path = config.metadata_dir.clone();
db_path.push("db"); db_path.push("db");
let db = db::sled_adapter::sled::Config::default() let db = db::sled_adapter::sled::Config::default()
.path(&db_path) .path(&db_path)
@ -44,8 +44,7 @@ pub async fn run_server(config_file: PathBuf) -> Result<(), Error> {
.expect("Unable to open sled DB"); .expect("Unable to open sled DB");
db::sled_adapter::SledDb::init(db) db::sled_adapter::SledDb::init(db)
} }
"sqlite" => { "sqlite" | "sqlite3" | "rusqlite" => {
let mut db_path = config.metadata_dir.clone();
db_path.push("db.sqlite"); db_path.push("db.sqlite");
let db = db::sqlite_adapter::rusqlite::Connection::open(db_path) let db = db::sqlite_adapter::rusqlite::Connection::open(db_path)
.expect("Unable to open sqlite DB"); .expect("Unable to open sqlite DB");