mirror of
https://github.com/vacp2p/pmtree.git
synced 2026-01-08 23:08:02 -05:00
fix: tests
This commit is contained in:
@@ -17,7 +17,9 @@ impl Database for MemoryDB {
|
||||
}
|
||||
|
||||
fn load(_db_config: MemoryDBConfig) -> PmtreeResult<Self> {
|
||||
Err(DatabaseError(DatabaseErrorKind::CannotLoadDatabase))
|
||||
Err(PmtreeErrorKind::DatabaseError(
|
||||
DatabaseErrorKind::CannotLoadDatabase,
|
||||
))
|
||||
}
|
||||
|
||||
fn get(&self, key: DBKey) -> PmtreeResult<Option<Value>> {
|
||||
|
||||
@@ -54,7 +54,9 @@ impl Database for MemoryDB {
|
||||
}
|
||||
|
||||
fn load(_db_config: MemoryDBConfig) -> PmtreeResult<Self> {
|
||||
Err(DatabaseError(DatabaseErrorKind::CannotLoadDatabase))
|
||||
Err(PmtreeErrorKind::DatabaseError(
|
||||
DatabaseErrorKind::CannotLoadDatabase,
|
||||
))
|
||||
}
|
||||
|
||||
fn get(&self, key: DBKey) -> PmtreeResult<Option<Value>> {
|
||||
@@ -85,7 +87,9 @@ impl Database for MySled {
|
||||
fn new(db_config: SledConfig) -> PmtreeResult<Self> {
|
||||
let db = sled::open(db_config.path).unwrap();
|
||||
if db.was_recovered() {
|
||||
return Err(DatabaseError(DatabaseErrorKind::DatabaseExists));
|
||||
return Err(PmtreeErrorKind::DatabaseError(
|
||||
DatabaseErrorKind::DatabaseExists,
|
||||
));
|
||||
}
|
||||
|
||||
Ok(MySled(db))
|
||||
@@ -96,7 +100,9 @@ impl Database for MySled {
|
||||
|
||||
if !db.was_recovered() {
|
||||
fs::remove_dir_all(&db_config.path).expect("Error removing db");
|
||||
return Err(DatabaseError(DatabaseErrorKind::CannotLoadDatabase));
|
||||
return Err(PmtreeErrorKind::DatabaseError(
|
||||
DatabaseErrorKind::CannotLoadDatabase,
|
||||
));
|
||||
}
|
||||
|
||||
Ok(MySled(db))
|
||||
|
||||
@@ -18,7 +18,9 @@ impl Database for MySled {
|
||||
fn new(db_config: SledConfig) -> PmtreeResult<Self> {
|
||||
let db = sled::open(db_config.path).unwrap();
|
||||
if db.was_recovered() {
|
||||
return Err(DatabaseError(DatabaseErrorKind::DatabaseExists));
|
||||
return Err(PmtreeErrorKind::DatabaseError(
|
||||
DatabaseErrorKind::DatabaseExists,
|
||||
));
|
||||
}
|
||||
|
||||
Ok(MySled(db))
|
||||
@@ -29,7 +31,9 @@ impl Database for MySled {
|
||||
|
||||
if !db.was_recovered() {
|
||||
fs::remove_dir_all(&db_config.path).expect("Error removing db");
|
||||
return Err(DatabaseError(DatabaseErrorKind::CannotLoadDatabase));
|
||||
return Err(PmtreeErrorKind::DatabaseError(
|
||||
DatabaseErrorKind::CannotLoadDatabase,
|
||||
));
|
||||
}
|
||||
|
||||
Ok(MySled(db))
|
||||
|
||||
Reference in New Issue
Block a user