Skip to content

Commit

Permalink
Update to use redb instead of rocksdb
Browse files Browse the repository at this point in the history
Signed-off-by: Heinz N. Gies <[email protected]>
  • Loading branch information
Licenser committed Nov 8, 2023
1 parent d167b45 commit 387c36d
Show file tree
Hide file tree
Showing 18 changed files with 552 additions and 953 deletions.
571 changes: 102 additions & 469 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 2 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,12 @@ socket2 = { version = "0.5", features = ["all"] }
tremor-common = { path = "tremor-common" }
tremor-config = { path = "tremor-config" }
tremor-codec = { path = "tremor-codec" }
tremor-influx = { path = "tremor-influx" }
tremor-pipeline = { path = "tremor-pipeline" }
tremor-script = { path = "tremor-script", features = ["arena-delete"] }
tremor-value = { path = "tremor-value" }
tremor-interceptor = { path = "tremor-interceptor" }
url = "2.4"
value-trait = "0.8"
tide = "0.16"
byteorder = "1.5"
axum = "0.6"

Expand Down Expand Up @@ -191,10 +189,6 @@ uuid = { version = "1.3", features = ["v4"] }

# wal
qwal = { git = "https://github.com/tremor-rs/qwal" }
itoa = "1"
ryu = "1"
lexical = "6"
simdutf8 = "0.1"

# Clustering
tarpc = { version = "0.33", features = ["full"] }
Expand All @@ -203,7 +197,8 @@ openraft = { version = "0.8.4", features = [
], git = "https://github.com/datafuselabs/openraft.git", rev = "e8bdd60" } # 6098f5cf61b074c8fccecf722278183c3ee5cd27

serde_json = "1.0.57"
rocksdb = { version = "0.19.0", git = "https://github.com/tremor-rs/rust-rocksdb", rev = "a02b00f029fb45d294715748cd2459491594e0e3" }
# rocksdb = { version = "0.19.0", git = "https://github.com/tremor-rs/rust-rocksdb", rev = "a02b00f029fb45d294715748cd2459491594e0e3" }
redb = "*"
tar = "0.4"
sha2 = "0.10"
rmp-serde = "1"
Expand Down
50 changes: 44 additions & 6 deletions src/raft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ use openraft::{
storage::Adaptor,
Config, ConfigError, Raft, TokioRuntime,
};
use redb::{CommitError, DatabaseError, StorageError, TableError, TransactionError};
use std::{
fmt::{Display, Formatter},
io::Cursor,
Expand Down Expand Up @@ -77,8 +78,16 @@ pub(crate) type TremorRaftImpl = Raft<TremorRaftConfig, Network, LogStore, State
pub enum ClusterError {
/// Generic error
Other(String),
/// RocksDB error
Rocks(rocksdb::Error),
/// Database error
Database(DatabaseError),
/// Transaction error
Transaction(TransactionError),
/// Transaction error
Table(TableError),
/// StorageError
Storage(StorageError),
/// Commit Error
Commit(CommitError),
/// IO error
Io(std::io::Error),
/// Store error
Expand Down Expand Up @@ -116,11 +125,36 @@ impl From<std::io::Error> for ClusterError {
}
}

impl From<rocksdb::Error> for ClusterError {
fn from(e: rocksdb::Error) -> Self {
ClusterError::Rocks(e)
impl From<redb::DatabaseError> for ClusterError {
fn from(e: redb::DatabaseError) -> Self {
ClusterError::Database(e)
}
}

impl From<redb::TransactionError> for ClusterError {
fn from(e: redb::TransactionError) -> Self {
ClusterError::Transaction(e)
}
}

impl From<redb::TableError> for ClusterError {
fn from(e: redb::TableError) -> Self {
ClusterError::Table(e)
}
}

impl From<redb::StorageError> for ClusterError {
fn from(e: redb::StorageError) -> Self {
ClusterError::Storage(e)
}
}

impl From<redb::CommitError> for ClusterError {
fn from(e: redb::CommitError) -> Self {
ClusterError::Commit(e)
}
}

impl From<&str> for ClusterError {
fn from(e: &str) -> Self {
ClusterError::Other(e.to_string())
Expand Down Expand Up @@ -191,7 +225,11 @@ impl Display for ClusterError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
ClusterError::Other(e) => e.fmt(f),
ClusterError::Rocks(e) => e.fmt(f),
ClusterError::Database(e) => e.fmt(f),
ClusterError::Transaction(e) => e.fmt(f),
ClusterError::Table(e) => e.fmt(f),
ClusterError::Storage(e) => e.fmt(f),
ClusterError::Commit(e) => e.fmt(f),
ClusterError::Io(e) => e.fmt(f),
ClusterError::Store(e) => e.fmt(f),
ClusterError::Initialize(e) => e.fmt(f),
Expand Down
Loading

0 comments on commit 387c36d

Please sign in to comment.