feat: replace TransactionDB with DB (#468)
Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
parent
1223e4d096
commit
af1fe2e91e
|
|
@ -959,7 +959,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dragonfly-client"
|
||||
version = "0.1.55"
|
||||
version = "0.1.56"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bytes",
|
||||
|
|
@ -1022,7 +1022,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dragonfly-client-backend"
|
||||
version = "0.1.55"
|
||||
version = "0.1.56"
|
||||
dependencies = [
|
||||
"dragonfly-client-core",
|
||||
"futures",
|
||||
|
|
@ -1040,7 +1040,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dragonfly-client-config"
|
||||
version = "0.1.55"
|
||||
version = "0.1.56"
|
||||
dependencies = [
|
||||
"dragonfly-client-core",
|
||||
"home",
|
||||
|
|
@ -1059,7 +1059,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dragonfly-client-core"
|
||||
version = "0.1.55"
|
||||
version = "0.1.56"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
"reqwest",
|
||||
|
|
@ -1070,7 +1070,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dragonfly-client-init"
|
||||
version = "0.1.55"
|
||||
version = "0.1.56"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
|
|
@ -1086,7 +1086,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dragonfly-client-storage"
|
||||
version = "0.1.55"
|
||||
version = "0.1.56"
|
||||
dependencies = [
|
||||
"base16ct",
|
||||
"blake3",
|
||||
|
|
@ -1110,7 +1110,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "dragonfly-client-util"
|
||||
version = "0.1.55"
|
||||
version = "0.1.56"
|
||||
dependencies = [
|
||||
"dragonfly-api",
|
||||
"dragonfly-client-core",
|
||||
|
|
@ -1568,7 +1568,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hdfs"
|
||||
version = "0.1.55"
|
||||
version = "0.1.56"
|
||||
dependencies = [
|
||||
"dragonfly-client-backend",
|
||||
"dragonfly-client-core",
|
||||
|
|
|
|||
16
Cargo.toml
16
Cargo.toml
|
|
@ -12,7 +12,7 @@ members = [
|
|||
]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.55"
|
||||
version = "0.1.56"
|
||||
authors = ["The Dragonfly Developers"]
|
||||
homepage = "https://d7y.io/"
|
||||
repository = "https://github.com/dragonflyoss/client.git"
|
||||
|
|
@ -22,13 +22,13 @@ readme = "README.md"
|
|||
edition = "2021"
|
||||
|
||||
[workspace.dependencies]
|
||||
dragonfly-client = { path = "dragonfly-client", version = "0.1.55" }
|
||||
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.1.55" }
|
||||
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.1.55" }
|
||||
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.1.55" }
|
||||
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.1.55" }
|
||||
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.1.55" }
|
||||
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.1.55" }
|
||||
dragonfly-client = { path = "dragonfly-client", version = "0.1.56" }
|
||||
dragonfly-client-core = { path = "dragonfly-client-core", version = "0.1.56" }
|
||||
dragonfly-client-config = { path = "dragonfly-client-config", version = "0.1.56" }
|
||||
dragonfly-client-storage = { path = "dragonfly-client-storage", version = "0.1.56" }
|
||||
dragonfly-client-backend = { path = "dragonfly-client-backend", version = "0.1.56" }
|
||||
dragonfly-client-util = { path = "dragonfly-client-util", version = "0.1.56" }
|
||||
dragonfly-client-init = { path = "dragonfly-client-init", version = "0.1.56" }
|
||||
thiserror = "1.0"
|
||||
dragonfly-api = "2.0.112"
|
||||
reqwest = { version = "0.11.27", features = ["stream", "native-tls", "default-tls", "rustls-tls"] }
|
||||
|
|
|
|||
|
|
@ -24,16 +24,16 @@ use tracing::info;
|
|||
|
||||
/// RocksdbStorageEngine is a storage engine based on rocksdb.
|
||||
pub struct RocksdbStorageEngine {
|
||||
// inner is the inner rocksdb transaction db.
|
||||
inner: rocksdb::TransactionDB,
|
||||
// inner is the inner rocksdb DB.
|
||||
inner: rocksdb::DB,
|
||||
}
|
||||
|
||||
// RocksdbStorageEngine implements deref of the storage engine.
|
||||
impl Deref for RocksdbStorageEngine {
|
||||
// Target is the inner rocksdb transaction db.
|
||||
type Target = rocksdb::TransactionDB;
|
||||
// Target is the inner rocksdb DB.
|
||||
type Target = rocksdb::DB;
|
||||
|
||||
// deref returns the inner rocksdb transaction db.
|
||||
// deref returns the inner rocksdb DB.
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.inner
|
||||
}
|
||||
|
|
@ -80,13 +80,7 @@ impl RocksdbStorageEngine {
|
|||
|
||||
// Open rocksdb.
|
||||
let dir = dir.join(Self::DEFAULT_DIR_NAME);
|
||||
let db = rocksdb::TransactionDB::open_cf(
|
||||
&options,
|
||||
&rocksdb::TransactionDBOptions::default(),
|
||||
&dir,
|
||||
cf_names,
|
||||
)
|
||||
.or_err(ErrorType::StorageError)?;
|
||||
let db = rocksdb::DB::open_cf(&options, &dir, cf_names).or_err(ErrorType::StorageError)?;
|
||||
info!("metadata initialized directory: {:?}", dir);
|
||||
|
||||
Ok(Self { inner: db })
|
||||
|
|
@ -149,7 +143,7 @@ impl Operations for RocksdbStorageEngine {
|
|||
impl<'db> StorageEngine<'db> for RocksdbStorageEngine {}
|
||||
|
||||
/// cf_handle returns the column family handle for the given object.
|
||||
fn cf_handle<T>(db: &rocksdb::TransactionDB) -> Result<&rocksdb::ColumnFamily>
|
||||
fn cf_handle<T>(db: &rocksdb::DB) -> Result<&rocksdb::ColumnFamily>
|
||||
where
|
||||
T: DatabaseObject,
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue