Merge pull request #6801 from paritytech/refactoring/journal-6693
Refactors journaldb as a separate crate
This commit is contained in:
commit
5281e09828
22
Cargo.lock
generated
22
Cargo.lock
generated
@ -539,6 +539,7 @@ dependencies = [
|
|||||||
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hyper 0.10.0-a.0 (git+https://github.com/paritytech/hyper)",
|
"hyper 0.10.0-a.0 (git+https://github.com/paritytech/hyper)",
|
||||||
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"journaldb 0.1.0",
|
||||||
"kvdb 0.1.0",
|
"kvdb 0.1.0",
|
||||||
"kvdb-memorydb 0.1.0",
|
"kvdb-memorydb 0.1.0",
|
||||||
"kvdb-rocksdb 0.1.0",
|
"kvdb-rocksdb 0.1.0",
|
||||||
@ -772,6 +773,7 @@ dependencies = [
|
|||||||
"hash 0.1.0",
|
"hash 0.1.0",
|
||||||
"hashdb 0.1.0",
|
"hashdb 0.1.0",
|
||||||
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"journaldb 0.1.0",
|
||||||
"kvdb 0.1.0",
|
"kvdb 0.1.0",
|
||||||
"kvdb-memorydb 0.1.0",
|
"kvdb-memorydb 0.1.0",
|
||||||
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -1252,6 +1254,25 @@ name = "itoa"
|
|||||||
version = "0.3.4"
|
version = "0.3.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "journaldb"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"ethcore-bigint 0.1.3",
|
||||||
|
"ethcore-bytes 0.1.0",
|
||||||
|
"ethcore-logger 1.9.0",
|
||||||
|
"hash 0.1.0",
|
||||||
|
"hashdb 0.1.0",
|
||||||
|
"heapsize 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"kvdb 0.1.0",
|
||||||
|
"kvdb-memorydb 0.1.0",
|
||||||
|
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"memorydb 0.1.0",
|
||||||
|
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rlp 0.2.0",
|
||||||
|
"util-error 0.1.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "jsonrpc-core"
|
name = "jsonrpc-core"
|
||||||
version = "8.0.0"
|
version = "8.0.0"
|
||||||
@ -1941,6 +1962,7 @@ dependencies = [
|
|||||||
"hash 0.1.0",
|
"hash 0.1.0",
|
||||||
"ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ipnetwork 0.12.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"isatty 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"isatty 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"journaldb 0.1.0",
|
||||||
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)",
|
"jsonrpc-core 8.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.8)",
|
||||||
"kvdb 0.1.0",
|
"kvdb 0.1.0",
|
||||||
"kvdb-rocksdb 0.1.0",
|
"kvdb-rocksdb 0.1.0",
|
||||||
|
@ -62,6 +62,7 @@ hash = { path = "util/hash" }
|
|||||||
migration = { path = "util/migration" }
|
migration = { path = "util/migration" }
|
||||||
kvdb = { path = "util/kvdb" }
|
kvdb = { path = "util/kvdb" }
|
||||||
kvdb-rocksdb = { path = "util/kvdb-rocksdb" }
|
kvdb-rocksdb = { path = "util/kvdb-rocksdb" }
|
||||||
|
journaldb = { path = "util/journaldb" }
|
||||||
|
|
||||||
parity-dapps = { path = "dapps", optional = true }
|
parity-dapps = { path = "dapps", optional = true }
|
||||||
clippy = { version = "0.0.103", optional = true}
|
clippy = { version = "0.0.103", optional = true}
|
||||||
|
@ -71,6 +71,7 @@ hash = { path = "../util/hash" }
|
|||||||
triehash = { path = "../util/triehash" }
|
triehash = { path = "../util/triehash" }
|
||||||
semantic_version = { path = "../util/semantic_version" }
|
semantic_version = { path = "../util/semantic_version" }
|
||||||
unexpected = { path = "../util/unexpected" }
|
unexpected = { path = "../util/unexpected" }
|
||||||
|
journaldb = { path = "../util/journaldb" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
native-contracts = { path = "native_contracts", features = ["test_contracts"] }
|
native-contracts = { path = "native_contracts", features = ["test_contracts"] }
|
||||||
|
@ -26,7 +26,8 @@ use itertools::Itertools;
|
|||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use timer::PerfTimer;
|
use timer::PerfTimer;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use util::{Address, journaldb, DBValue};
|
use util::{Address, DBValue};
|
||||||
|
use journaldb;
|
||||||
use util_error::UtilError;
|
use util_error::UtilError;
|
||||||
use trie::{TrieSpec, TrieFactory, Trie};
|
use trie::{TrieSpec, TrieFactory, Trie};
|
||||||
use kvdb::{KeyValueDB, DBTransaction};
|
use kvdb::{KeyValueDB, DBTransaction};
|
||||||
|
@ -20,7 +20,7 @@ use std::fmt::{Display, Formatter, Error as FmtError};
|
|||||||
|
|
||||||
use mode::Mode as IpcMode;
|
use mode::Mode as IpcMode;
|
||||||
use verification::{VerifierType, QueueConfig};
|
use verification::{VerifierType, QueueConfig};
|
||||||
use util::journaldb;
|
use journaldb;
|
||||||
use kvdb_rocksdb::CompactionProfile;
|
use kvdb_rocksdb::CompactionProfile;
|
||||||
|
|
||||||
pub use std::time::Duration;
|
pub use std::time::Duration;
|
||||||
|
@ -20,7 +20,7 @@ use std::fmt;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::journaldb;
|
use journaldb;
|
||||||
use {trie, kvdb_memorydb, bytes};
|
use {trie, kvdb_memorydb, bytes};
|
||||||
use kvdb::{self, KeyValueDB};
|
use kvdb::{self, KeyValueDB};
|
||||||
use {state, state_db, client, executive, trace, transaction, db, spec, pod_state};
|
use {state, state_db, client, executive, trace, transaction, db, spec, pod_state};
|
||||||
|
@ -26,7 +26,8 @@ use hash::keccak;
|
|||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use parking_lot::RwLock;
|
use parking_lot::RwLock;
|
||||||
use util::*;
|
use journaldb;
|
||||||
|
use util::{Address, DBValue};
|
||||||
use kvdb_rocksdb::{Database, DatabaseConfig};
|
use kvdb_rocksdb::{Database, DatabaseConfig};
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use rlp::*;
|
use rlp::*;
|
||||||
|
@ -131,6 +131,7 @@ extern crate vm;
|
|||||||
extern crate wasm;
|
extern crate wasm;
|
||||||
extern crate ethcore_util as util;
|
extern crate ethcore_util as util;
|
||||||
extern crate memory_cache;
|
extern crate memory_cache;
|
||||||
|
extern crate journaldb;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate macros;
|
extern crate macros;
|
||||||
|
@ -23,7 +23,7 @@ use trie::TrieDB;
|
|||||||
use views::HeaderView;
|
use views::HeaderView;
|
||||||
use bloom_journal::Bloom;
|
use bloom_journal::Bloom;
|
||||||
use migration::{Error, Migration, Progress, Batch, Config, ErrorKind};
|
use migration::{Error, Migration, Progress, Batch, Config, ErrorKind};
|
||||||
use util::journaldb;
|
use journaldb;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use trie::Trie;
|
use trie::Trie;
|
||||||
use kvdb::{DBTransaction, ResultExt};
|
use kvdb::{DBTransaction, ResultExt};
|
||||||
|
@ -36,7 +36,7 @@ use util::{HashDB, DBValue};
|
|||||||
use snappy;
|
use snappy;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use util::journaldb::{self, Algorithm, JournalDB};
|
use journaldb::{self, Algorithm, JournalDB};
|
||||||
use kvdb::KeyValueDB;
|
use kvdb::KeyValueDB;
|
||||||
use trie::{TrieDB, TrieDBMut, Trie, TrieMut};
|
use trie::{TrieDB, TrieDBMut, Trie, TrieMut};
|
||||||
use rlp::{RlpStream, UntrustedRlp};
|
use rlp::{RlpStream, UntrustedRlp};
|
||||||
|
@ -39,7 +39,7 @@ use bigint::hash::H256;
|
|||||||
use parking_lot::{Mutex, RwLock, RwLockReadGuard};
|
use parking_lot::{Mutex, RwLock, RwLockReadGuard};
|
||||||
use util_error::UtilError;
|
use util_error::UtilError;
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use util::journaldb::Algorithm;
|
use journaldb::Algorithm;
|
||||||
use kvdb_rocksdb::{Database, DatabaseConfig};
|
use kvdb_rocksdb::{Database, DatabaseConfig};
|
||||||
use snappy;
|
use snappy;
|
||||||
|
|
||||||
@ -625,7 +625,7 @@ mod tests {
|
|||||||
use io::{IoService};
|
use io::{IoService};
|
||||||
use devtools::RandomTempPath;
|
use devtools::RandomTempPath;
|
||||||
use tests::helpers::get_test_spec;
|
use tests::helpers::get_test_spec;
|
||||||
use util::journaldb::Algorithm;
|
use journaldb::Algorithm;
|
||||||
use error::Error;
|
use error::Error;
|
||||||
use snapshot::{ManifestData, RestorationStatus, SnapshotService};
|
use snapshot::{ManifestData, RestorationStatus, SnapshotService};
|
||||||
use super::*;
|
use super::*;
|
||||||
|
@ -35,7 +35,7 @@ use util::DBValue;
|
|||||||
use kvdb::KeyValueDB;
|
use kvdb::KeyValueDB;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use hashdb::HashDB;
|
use hashdb::HashDB;
|
||||||
use util::journaldb;
|
use journaldb;
|
||||||
use trie::{Alphabet, StandardMap, SecTrieDBMut, TrieMut, ValueMode};
|
use trie::{Alphabet, StandardMap, SecTrieDBMut, TrieMut, ValueMode};
|
||||||
use trie::{TrieDB, TrieDBMut, Trie};
|
use trie::{TrieDB, TrieDBMut, Trie};
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ fn restored_is_equivalent() {
|
|||||||
engine: spec.engine.clone(),
|
engine: spec.engine.clone(),
|
||||||
genesis_block: spec.genesis_block(),
|
genesis_block: spec.genesis_block(),
|
||||||
db_config: db_config,
|
db_config: db_config,
|
||||||
pruning: ::util::journaldb::Algorithm::Archive,
|
pruning: ::journaldb::Algorithm::Archive,
|
||||||
channel: IoChannel::disconnected(),
|
channel: IoChannel::disconnected(),
|
||||||
snapshot_root: path,
|
snapshot_root: path,
|
||||||
db_restore: client2.clone(),
|
db_restore: client2.clone(),
|
||||||
@ -112,7 +112,7 @@ fn guards_delete_folders() {
|
|||||||
engine: spec.engine.clone(),
|
engine: spec.engine.clone(),
|
||||||
genesis_block: spec.genesis_block(),
|
genesis_block: spec.genesis_block(),
|
||||||
db_config: DatabaseConfig::with_columns(::db::NUM_COLUMNS),
|
db_config: DatabaseConfig::with_columns(::db::NUM_COLUMNS),
|
||||||
pruning: ::util::journaldb::Algorithm::Archive,
|
pruning: ::journaldb::Algorithm::Archive,
|
||||||
channel: IoChannel::disconnected(),
|
channel: IoChannel::disconnected(),
|
||||||
snapshot_root: path.clone(),
|
snapshot_root: path.clone(),
|
||||||
db_restore: Arc::new(NoopDBRestore),
|
db_restore: Arc::new(NoopDBRestore),
|
||||||
|
@ -26,7 +26,7 @@ use error::Error;
|
|||||||
|
|
||||||
use rand::{XorShiftRng, SeedableRng};
|
use rand::{XorShiftRng, SeedableRng};
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::journaldb::{self, Algorithm};
|
use journaldb::{self, Algorithm};
|
||||||
use kvdb_rocksdb::{Database, DatabaseConfig};
|
use kvdb_rocksdb::{Database, DatabaseConfig};
|
||||||
use memorydb::MemoryDB;
|
use memorydb::MemoryDB;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
@ -670,7 +670,7 @@ impl Spec {
|
|||||||
/// constructor.
|
/// constructor.
|
||||||
pub fn genesis_epoch_data(&self) -> Result<Vec<u8>, String> {
|
pub fn genesis_epoch_data(&self) -> Result<Vec<u8>, String> {
|
||||||
use transaction::{Action, Transaction};
|
use transaction::{Action, Transaction};
|
||||||
use util::journaldb;
|
use journaldb;
|
||||||
use kvdb_memorydb;
|
use kvdb_memorydb;
|
||||||
|
|
||||||
let genesis = self.genesis_header();
|
let genesis = self.genesis_header();
|
||||||
|
@ -18,7 +18,7 @@ use std::collections::{VecDeque, HashSet};
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use lru_cache::LruCache;
|
use lru_cache::LruCache;
|
||||||
use memory_cache::MemoryLruCache;
|
use memory_cache::MemoryLruCache;
|
||||||
use util::journaldb::JournalDB;
|
use journaldb::JournalDB;
|
||||||
use kvdb::{KeyValueDB, DBTransaction};
|
use kvdb::{KeyValueDB, DBTransaction};
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use hashdb::HashDB;
|
use hashdb::HashDB;
|
||||||
|
@ -36,7 +36,6 @@ use state_db::StateDB;
|
|||||||
use state::*;
|
use state::*;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use transaction::{Action, Transaction, SignedTransaction};
|
use transaction::{Action, Transaction, SignedTransaction};
|
||||||
use util::*;
|
|
||||||
use views::BlockView;
|
use views::BlockView;
|
||||||
|
|
||||||
// TODO: move everything over to get_null_spec.
|
// TODO: move everything over to get_null_spec.
|
||||||
@ -282,7 +281,7 @@ pub fn get_temp_state_with_factory(factory: EvmFactory) -> State<::state_db::Sta
|
|||||||
|
|
||||||
pub fn get_temp_state_db() -> StateDB {
|
pub fn get_temp_state_db() -> StateDB {
|
||||||
let db = new_db();
|
let db = new_db();
|
||||||
let journal_db = journaldb::new(db, journaldb::Algorithm::EarlyMerge, ::db::COL_STATE);
|
let journal_db = ::journaldb::new(db, ::journaldb::Algorithm::EarlyMerge, ::db::COL_STATE);
|
||||||
StateDB::new(journal_db, 5 * 1024 * 1024)
|
StateDB::new(journal_db, 5 * 1024 * 1024)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::{PathBuf, Path};
|
use std::path::{PathBuf, Path};
|
||||||
use bigint::hash::{H64, H256};
|
use bigint::hash::{H64, H256};
|
||||||
use util::journaldb::Algorithm;
|
use journaldb::Algorithm;
|
||||||
use helpers::{replace_home, replace_home_and_local};
|
use helpers::{replace_home, replace_home_and_local};
|
||||||
use app_dirs::{AppInfo, get_app_root, AppDataType};
|
use app_dirs::{AppInfo, get_app_root, AppDataType};
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ use bigint::prelude::U256;
|
|||||||
use bigint::hash::clean_0x;
|
use bigint::hash::clean_0x;
|
||||||
use util::Address;
|
use util::Address;
|
||||||
use kvdb_rocksdb::CompactionProfile;
|
use kvdb_rocksdb::CompactionProfile;
|
||||||
use util::journaldb::Algorithm;
|
use journaldb::Algorithm;
|
||||||
use ethcore::client::{Mode, BlockId, VMType, DatabaseCompactionProfile, ClientConfig, VerifierType};
|
use ethcore::client::{Mode, BlockId, VMType, DatabaseCompactionProfile, ClientConfig, VerifierType};
|
||||||
use ethcore::miner::{PendingSet, GasLimit, PrioritizationStrategy};
|
use ethcore::miner::{PendingSet, GasLimit, PrioritizationStrategy};
|
||||||
use cache::CacheConfig;
|
use cache::CacheConfig;
|
||||||
|
@ -76,6 +76,7 @@ extern crate path;
|
|||||||
extern crate rpc_cli;
|
extern crate rpc_cli;
|
||||||
extern crate node_filter;
|
extern crate node_filter;
|
||||||
extern crate hash;
|
extern crate hash;
|
||||||
|
extern crate journaldb;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log as rlog;
|
extern crate log as rlog;
|
||||||
|
@ -20,7 +20,7 @@ use std::io::{Read, Write, Error as IoError, ErrorKind};
|
|||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::fmt::{Display, Formatter, Error as FmtError};
|
use std::fmt::{Display, Formatter, Error as FmtError};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use util::journaldb::Algorithm;
|
use journaldb::Algorithm;
|
||||||
use migr::{self, Manager as MigrationManager, Config as MigrationConfig, Migration};
|
use migr::{self, Manager as MigrationManager, Config as MigrationConfig, Migration};
|
||||||
use kvdb;
|
use kvdb;
|
||||||
use kvdb_rocksdb::{CompactionProfile, Database, DatabaseConfig};
|
use kvdb_rocksdb::{CompactionProfile, Database, DatabaseConfig};
|
||||||
@ -282,7 +282,6 @@ pub fn migrate(path: &Path, pruning: Algorithm, compaction_profile: CompactionPr
|
|||||||
mod legacy {
|
mod legacy {
|
||||||
use super::*;
|
use super::*;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use util::journaldb::Algorithm;
|
|
||||||
use migr::{Manager as MigrationManager};
|
use migr::{Manager as MigrationManager};
|
||||||
use kvdb_rocksdb::CompactionProfile;
|
use kvdb_rocksdb::CompactionProfile;
|
||||||
use ethcore::migrations;
|
use ethcore::migrations;
|
||||||
|
@ -18,7 +18,7 @@ use std::{str, fs, fmt};
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
use util::{Address, version_data};
|
use util::{Address, version_data};
|
||||||
use util::journaldb::Algorithm;
|
use journaldb::Algorithm;
|
||||||
use ethcore::spec::{Spec, SpecParams};
|
use ethcore::spec::{Spec, SpecParams};
|
||||||
use ethcore::ethereum;
|
use ethcore::ethereum;
|
||||||
use ethcore::client::Mode;
|
use ethcore::client::Mode;
|
||||||
@ -326,7 +326,7 @@ pub fn mode_switch_to_bool(switch: Option<Mode>, user_defaults: &UserDefaults) -
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use util::journaldb::Algorithm;
|
use journaldb::Algorithm;
|
||||||
use user_defaults::UserDefaults;
|
use user_defaults::UserDefaults;
|
||||||
use super::{SpecType, Pruning, ResealPolicy, Switch, tracing_switch_to_bool};
|
use super::{SpecType, Pruning, ResealPolicy, Switch, tracing_switch_to_bool};
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ use ansi_term::Colour;
|
|||||||
use util::version;
|
use util::version;
|
||||||
use parking_lot::{Condvar, Mutex};
|
use parking_lot::{Condvar, Mutex};
|
||||||
use node_filter::NodeFilter;
|
use node_filter::NodeFilter;
|
||||||
use util::journaldb::Algorithm;
|
use journaldb::Algorithm;
|
||||||
|
|
||||||
use params::{
|
use params::{
|
||||||
SpecType, Pruning, AccountsConfig, GasPricerConfig, MinerExtras, Switch,
|
SpecType, Pruning, AccountsConfig, GasPricerConfig, MinerExtras, Switch,
|
||||||
|
@ -25,7 +25,7 @@ use std::io::{Read, Write};
|
|||||||
use std::path::{PathBuf, Path};
|
use std::path::{PathBuf, Path};
|
||||||
use dir::{DatabaseDirectories, default_data_path};
|
use dir::{DatabaseDirectories, default_data_path};
|
||||||
use helpers::replace_home;
|
use helpers::replace_home;
|
||||||
use util::journaldb::Algorithm;
|
use journaldb::Algorithm;
|
||||||
|
|
||||||
#[cfg_attr(feature="dev", allow(enum_variant_names))]
|
#[cfg_attr(feature="dev", allow(enum_variant_names))]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -26,7 +26,7 @@ use serde::de::value::MapAccessDeserializer;
|
|||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use serde_json::de::from_reader;
|
use serde_json::de::from_reader;
|
||||||
use serde_json::ser::to_string;
|
use serde_json::ser::to_string;
|
||||||
use util::journaldb::Algorithm;
|
use journaldb::Algorithm;
|
||||||
use ethcore::client::Mode;
|
use ethcore::client::Mode;
|
||||||
|
|
||||||
pub struct UserDefaults {
|
pub struct UserDefaults {
|
||||||
|
@ -32,6 +32,7 @@ ethcore-bytes = { path = "bytes" }
|
|||||||
memorydb = { path = "memorydb" }
|
memorydb = { path = "memorydb" }
|
||||||
util-error = { path = "error" }
|
util-error = { path = "error" }
|
||||||
kvdb = { path = "kvdb" }
|
kvdb = { path = "kvdb" }
|
||||||
|
journaldb = { path = "journaldb" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
kvdb-memorydb = { path = "kvdb-memorydb" }
|
kvdb-memorydb = { path = "kvdb-memorydb" }
|
||||||
|
23
util/journaldb/Cargo.toml
Normal file
23
util/journaldb/Cargo.toml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
[package]
|
||||||
|
name = "journaldb"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
|
description = "A `HashDB` which can manage a short-term journal potentially containing many forks of mutually exclusive actions"
|
||||||
|
license = "GPL3"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
ethcore-bigint = { path = "../bigint", features = ["heapsizeof"] }
|
||||||
|
ethcore-bytes = { path = "../bytes" }
|
||||||
|
hashdb = { path = "../hashdb" }
|
||||||
|
heapsize = "0.4"
|
||||||
|
kvdb = { path = "../kvdb" }
|
||||||
|
log = "0.3"
|
||||||
|
memorydb = { path = "../memorydb" }
|
||||||
|
parking_lot = "0.4"
|
||||||
|
rlp = { path = "../rlp" }
|
||||||
|
util-error = { path = "../error" }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
ethcore-logger = { path = "../../logger" }
|
||||||
|
hash = { path = "../hash" }
|
||||||
|
kvdb-memorydb = { path = "../kvdb-memorydb" }
|
@ -21,9 +21,9 @@ use std::collections::hash_map::Entry;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use rlp::*;
|
use rlp::*;
|
||||||
use hashdb::*;
|
use hashdb::*;
|
||||||
use super::super::memorydb::*;
|
use super::memorydb::*;
|
||||||
use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
|
use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
|
||||||
use super::traits::JournalDB;
|
use traits::JournalDB;
|
||||||
use kvdb::{KeyValueDB, DBTransaction};
|
use kvdb::{KeyValueDB, DBTransaction};
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use error::{BaseDataError, UtilError};
|
use error::{BaseDataError, UtilError};
|
||||||
@ -202,8 +202,7 @@ mod tests {
|
|||||||
use keccak::keccak;
|
use keccak::keccak;
|
||||||
use hashdb::{HashDB, DBValue};
|
use hashdb::{HashDB, DBValue};
|
||||||
use super::*;
|
use super::*;
|
||||||
use journaldb::traits::JournalDB;
|
use {kvdb_memorydb, JournalDB};
|
||||||
use kvdb_memorydb;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn insert_same_in_fork() {
|
fn insert_same_in_fork() {
|
@ -16,6 +16,26 @@
|
|||||||
|
|
||||||
//! `JournalDB` interface and implementation.
|
//! `JournalDB` interface and implementation.
|
||||||
|
|
||||||
|
extern crate heapsize;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate log;
|
||||||
|
|
||||||
|
extern crate ethcore_bigint as bigint;
|
||||||
|
extern crate ethcore_bytes as bytes;
|
||||||
|
extern crate hashdb;
|
||||||
|
extern crate kvdb;
|
||||||
|
extern crate memorydb;
|
||||||
|
extern crate parking_lot;
|
||||||
|
extern crate rlp;
|
||||||
|
extern crate util_error as error;
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
extern crate ethcore_logger;
|
||||||
|
#[cfg(test)]
|
||||||
|
extern crate hash as keccak;
|
||||||
|
#[cfg(test)]
|
||||||
|
extern crate kvdb_memorydb;
|
||||||
|
|
||||||
use std::{fmt, str};
|
use std::{fmt, str};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
@ -26,6 +46,8 @@ mod earlymergedb;
|
|||||||
mod overlayrecentdb;
|
mod overlayrecentdb;
|
||||||
mod refcounteddb;
|
mod refcounteddb;
|
||||||
|
|
||||||
|
pub mod overlaydb;
|
||||||
|
|
||||||
/// Export the `JournalDB` trait.
|
/// Export the `JournalDB` trait.
|
||||||
pub use self::traits::JournalDB;
|
pub use self::traits::JournalDB;
|
||||||
|
|
@ -459,8 +459,7 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use hashdb::{HashDB, DBValue};
|
use hashdb::{HashDB, DBValue};
|
||||||
use ethcore_logger::init_log;
|
use ethcore_logger::init_log;
|
||||||
use journaldb::JournalDB;
|
use {kvdb_memorydb, JournalDB};
|
||||||
use kvdb_memorydb;
|
|
||||||
|
|
||||||
fn new_db() -> OverlayRecentDB {
|
fn new_db() -> OverlayRecentDB {
|
||||||
let backing = Arc::new(kvdb_memorydb::create(0));
|
let backing = Arc::new(kvdb_memorydb::create(0));
|
@ -210,9 +210,8 @@ mod tests {
|
|||||||
|
|
||||||
use keccak::keccak;
|
use keccak::keccak;
|
||||||
use hashdb::{HashDB, DBValue};
|
use hashdb::{HashDB, DBValue};
|
||||||
use kvdb_memorydb;
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use super::super::traits::JournalDB;
|
use {JournalDB, kvdb_memorydb};
|
||||||
|
|
||||||
fn new_db() -> RefCountedDB {
|
fn new_db() -> RefCountedDB {
|
||||||
let backing = Arc::new(kvdb_memorydb::create(0));
|
let backing = Arc::new(kvdb_memorydb::create(0));
|
@ -112,18 +112,12 @@ extern crate util_error as error;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern crate kvdb_memorydb;
|
extern crate kvdb_memorydb;
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate log as rlog;
|
|
||||||
|
|
||||||
pub mod misc;
|
pub mod misc;
|
||||||
pub mod overlaydb;
|
|
||||||
pub mod journaldb;
|
|
||||||
|
|
||||||
pub use misc::*;
|
pub use misc::*;
|
||||||
pub use hashdb::*;
|
pub use hashdb::*;
|
||||||
pub use memorydb::MemoryDB;
|
pub use memorydb::MemoryDB;
|
||||||
pub use overlaydb::*;
|
|
||||||
pub use journaldb::JournalDB;
|
|
||||||
|
|
||||||
/// 160-bit integer representing account address
|
/// 160-bit integer representing account address
|
||||||
pub type Address = bigint::hash::H160;
|
pub type Address = bigint::hash::H160;
|
||||||
|
Loading…
Reference in New Issue
Block a user