feat: update redb (#1071)

This commit is contained in:
thesimplekid
2025-09-13 11:12:00 +01:00
committed by GitHub
parent 835c66dd55
commit aab85d2083
3 changed files with 13 additions and 2 deletions

View File

@@ -19,7 +19,7 @@ auth = ["cdk-common/auth"]
[dependencies]
async-trait.workspace = true
cdk-common = { workspace = true, features = ["test"] }
redb = "2.4.0"
redb = "2.6.3"
thiserror.workspace = true
tracing.workspace = true
serde.workspace = true

View File

@@ -25,6 +25,9 @@ pub enum Error {
/// Redb Storage Error
#[error(transparent)]
Storage(#[from] Box<redb::StorageError>),
/// Upgrade Transaction Error
#[error(transparent)]
Upgrade(#[from] Box<redb::UpgradeError>),
/// Serde Json Error
#[error(transparent)]
Serde(#[from] serde_json::Error),
@@ -111,3 +114,9 @@ impl From<redb::StorageError> for Error {
Self::Storage(Box::new(e))
}
}
impl From<redb::UpgradeError> for Error {
fn from(e: redb::UpgradeError) -> Self {
Self::Upgrade(Box::new(e))
}
}

View File

@@ -156,7 +156,9 @@ impl WalletRedbDatabase {
drop(db);
}
let db = Database::create(path)?;
let mut db = Database::create(path)?;
db.upgrade()?;
Ok(Self { db: Arc::new(db) })
}