Skip to content

Commit

Permalink
refactor: move cachedb to db module
Browse files Browse the repository at this point in the history
  • Loading branch information
quake committed Apr 10, 2019
1 parent ecb4ec0 commit 4c06dca
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 12 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions benches/benches/process_block.rs
Expand Up @@ -6,9 +6,8 @@ use ckb_core::script::Script;
use ckb_core::transaction::{
CellInput, CellOutput, OutPoint, ProposalShortId, Transaction, TransactionBuilder,
};
use ckb_db::{DBConfig, RocksDB};
use ckb_db::{CacheDB, DBConfig, RocksDB};
use ckb_notify::NotifyService;
use ckb_shared::cachedb::CacheDB;
use ckb_shared::shared::{Shared, SharedBuilder};
use ckb_shared::store::ChainKVStore;
use ckb_traits::ChainProvider;
Expand Down
1 change: 1 addition & 0 deletions db/Cargo.toml
Expand Up @@ -14,6 +14,7 @@ serde_derive = "1.0"
serde_json = "1.0"
failure = "0.1.5"
log = "0.4"
lru-cache = { git = "https://github.com/nervosnetwork/lru-cache" }

[dev-dependencies]
tempfile = "3.0"
2 changes: 1 addition & 1 deletion shared/src/cachedb.rs → db/src/cachedb.rs
@@ -1,4 +1,4 @@
use ckb_db::{Col, KeyValueDB, Result};
use crate::{Col, KeyValueDB, Result};
use ckb_util::RwLock;
use fnv::FnvHashMap;
use lru_cache::LruCache;
Expand Down
2 changes: 2 additions & 0 deletions db/src/lib.rs
Expand Up @@ -7,10 +7,12 @@ use failure::Fail;
use std::ops::Range;
use std::result;

pub mod cachedb;
pub mod config;
pub mod memorydb;
pub mod rocksdb;

pub use crate::cachedb::CacheDB;
pub use crate::config::DBConfig;
pub use crate::memorydb::MemoryKeyValueDB;
pub use crate::rocksdb::RocksDB;
Expand Down
1 change: 0 additions & 1 deletion shared/src/lib.rs
Expand Up @@ -7,7 +7,6 @@
//! - [Chain](chain::chain::Chain) represent a struct which
//! implement `ChainProvider`

pub mod cachedb;
pub mod cell_set;
pub mod chain_state;
pub mod error;
Expand Down
3 changes: 1 addition & 2 deletions shared/src/shared.rs
@@ -1,4 +1,3 @@
use crate::cachedb::CacheDB;
use crate::cell_set::CellSet;
use crate::chain_state::ChainState;
use crate::error::SharedError;
Expand All @@ -13,7 +12,7 @@ use ckb_core::extras::BlockExt;
use ckb_core::header::{BlockNumber, Header};
use ckb_core::transaction::{Capacity, ProposalShortId, Transaction};
use ckb_core::uncle::UncleBlock;
use ckb_db::{DBConfig, KeyValueDB, MemoryKeyValueDB, RocksDB};
use ckb_db::{CacheDB, DBConfig, KeyValueDB, MemoryKeyValueDB, RocksDB};
use ckb_traits::{BlockMedianTimeContext, ChainProvider};
use ckb_util::Mutex;
use failure::Error;
Expand Down
3 changes: 1 addition & 2 deletions src/cli/export.rs
@@ -1,7 +1,6 @@
use super::super::setup::Setup;
use ckb_db::RocksDB;
use ckb_db::{CacheDB, RocksDB};
use ckb_instrument::{Export, Format};
use ckb_shared::cachedb::CacheDB;
use ckb_shared::shared::SharedBuilder;
use clap::{value_t, ArgMatches};

Expand Down
3 changes: 1 addition & 2 deletions src/cli/import.rs
@@ -1,9 +1,8 @@
use super::super::setup::Setup;
use ckb_chain::chain::ChainBuilder;
use ckb_db::RocksDB;
use ckb_db::{CacheDB, RocksDB};
use ckb_instrument::{Format, Import};
use ckb_notify::NotifyService;
use ckb_shared::cachedb::CacheDB;
use ckb_shared::shared::SharedBuilder;
use clap::{value_t, ArgMatches};

Expand Down
3 changes: 1 addition & 2 deletions src/cli/run_impl.rs
@@ -1,12 +1,11 @@
use crate::helper::wait_for_exit;
use crate::Setup;
use ckb_chain::chain::{ChainBuilder, ChainController};
use ckb_db::RocksDB;
use ckb_db::{CacheDB, RocksDB};
use ckb_miner::BlockAssembler;
use ckb_network::{CKBProtocol, NetworkService, NetworkState, ProtocolId};
use ckb_notify::{NotifyController, NotifyService};
use ckb_rpc::RpcServer;
use ckb_shared::cachedb::CacheDB;
use ckb_shared::index::ChainIndex;
use ckb_shared::shared::{Shared, SharedBuilder};
use ckb_sync::{NetTimeProtocol, NetworkProtocol, Relayer, Synchronizer};
Expand Down

0 comments on commit 4c06dca

Please sign in to comment.