Use rocksdb as storage backend (#585)

* finish rocksdb storage service

* use rocksdb

* create missing cf

* Update Cargo.toml
This commit is contained in:
Al Liu 2024-03-21 19:23:26 +08:00 committed by GitHub
parent 502c791318
commit fd8ea50dd1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 14 additions and 10 deletions

View File

@ -30,10 +30,12 @@ nomos-mempool = { path = "../../nomos-services/mempool", features = [
] }
nomos-metrics = { path = "../../nomos-metrics" }
nomos-http = { path = "../../nomos-services/http", features = ["http"] }
nomos-storage = { path = "../../nomos-services/storage", features = ["rocksdb"] }
carnot-consensus = { path = "../../nomos-services/carnot-consensus", features = [
"libp2p",
] }
nomos-storage = { path = "../../nomos-services/storage", features = ["sled"] }
nomos-libp2p = { path = "../../nomos-libp2p" }
nomos-da = { path = "../../nomos-services/data-availability", features = [
"libp2p",

View File

@ -34,7 +34,7 @@ use nomos_mempool::{
use nomos_metrics::Metrics;
use nomos_network::backends::libp2p::Libp2p as NetworkBackend;
use nomos_storage::{
backends::{sled::SledBackend, StorageSerde},
backends::{rocksdb::RocksBackend, StorageSerde},
StorageService,
};
@ -73,7 +73,7 @@ pub type Carnot = CarnotConsensus<
TreeOverlay<RoundRobin, RandomBeaconState>,
FillSizeWithTx<MB16, Tx>,
FillSizeWithBlobsCertificate<MB16, Certificate>,
SledBackend<Wire>,
RocksBackend<Wire>,
>;
pub type DataAvailability = DataAvailabilityService<
@ -99,7 +99,7 @@ pub struct Nomos {
consensus: ServiceHandle<Carnot>,
http: ServiceHandle<ApiService<AxumBackend<Tx, Wire, MB16>>>,
da: ServiceHandle<DataAvailability>,
storage: ServiceHandle<StorageService<SledBackend<Wire>>>,
storage: ServiceHandle<StorageService<RocksBackend<Wire>>>,
#[cfg(feature = "metrics")]
metrics: ServiceHandle<Metrics>,
system_sig: ServiceHandle<SystemSig>,

View File

@ -99,8 +99,10 @@ fn main() -> Result<()> {
#[cfg(feature = "metrics")]
metrics: MetricsSettings { registry },
da: config.da,
storage: nomos_storage::backends::sled::SledBackendSettings {
storage: nomos_storage::backends::rocksdb::RocksBackendSettings {
db_path: std::path::PathBuf::from(DEFAULT_DB_PATH),
read_only: false,
column_family: Some("blocks".into()),
},
system_sig: (),
},

View File

@ -24,7 +24,7 @@ nomos-mempool = { path = "../../nomos-services/mempool", features = [
"openapi",
] }
nomos-metrics = { path = "../../nomos-metrics" }
nomos-storage = { path = "../../nomos-services/storage", features = ["sled"] }
nomos-storage = { path = "../../nomos-services/storage", features = ["rocksdb"] }
nomos-libp2p = { path = "../../nomos-libp2p" }
full-replication = { path = "../../nomos-da/full-replication" }
serde = { version = "1", features = ["derive"] }

View File

@ -24,7 +24,7 @@ use nomos_core::{
use nomos_mempool::{
backend::mockpool::MockPool, network::adapters::libp2p::Libp2pAdapter as MempoolNetworkAdapter,
};
use nomos_storage::backends::{sled::SledBackend, StorageSerde};
use nomos_storage::backends::{rocksdb::RocksBackend, StorageSerde};
pub type Carnot<Tx, SS, const SIZE: usize> = CarnotConsensus<
ConsensusNetworkAdapter,
@ -42,7 +42,7 @@ pub type Carnot<Tx, SS, const SIZE: usize> = CarnotConsensus<
TreeOverlay<RoundRobin, RandomBeaconState>,
FillSizeWithTx<SIZE, Tx>,
FillSizeWithBlobsCertificate<SIZE, Certificate>,
SledBackend<SS>,
RocksBackend<SS>,
>;
pub async fn carnot_info<Tx, SS, const SIZE: usize>(

View File

@ -1,7 +1,7 @@
use nomos_core::block::Block;
use nomos_core::header::HeaderId;
use nomos_storage::{
backends::{sled::SledBackend, StorageSerde},
backends::{rocksdb::RocksBackend, StorageSerde},
StorageMsg, StorageService,
};
@ -14,7 +14,7 @@ where
S: StorageSerde + Send + Sync + 'static,
{
let relay = handle
.relay::<StorageService<SledBackend<S>>>()
.relay::<StorageService<RocksBackend<S>>>()
.connect()
.await?;
let (msg, receiver) = StorageMsg::new_load_message(id);