renamed kvdb_memorydb::in_memory -> kvdb_memorydb::create
This commit is contained in:
parent
d88ec35a6a
commit
616cafb04a
@ -729,13 +729,13 @@ mod tests {
|
|||||||
use ethcore::spec::Spec;
|
use ethcore::spec::Spec;
|
||||||
use cache::Cache;
|
use cache::Cache;
|
||||||
use kvdb::KeyValueDB;
|
use kvdb::KeyValueDB;
|
||||||
use kvdb_memorydb::in_memory;
|
use kvdb_memorydb;
|
||||||
|
|
||||||
use time::Duration;
|
use time::Duration;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
|
|
||||||
fn make_db() -> Arc<KeyValueDB> {
|
fn make_db() -> Arc<KeyValueDB> {
|
||||||
Arc::new(in_memory(0))
|
Arc::new(kvdb_memorydb::create(0))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -215,7 +215,7 @@ impl<T: ChainDataFetcher> Client<T> {
|
|||||||
io_channel: IoChannel<ClientIoMessage>,
|
io_channel: IoChannel<ClientIoMessage>,
|
||||||
cache: Arc<Mutex<Cache>>
|
cache: Arc<Mutex<Cache>>
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let db = ::kvdb_memorydb::in_memory(0);
|
let db = ::kvdb_memorydb::create(0);
|
||||||
|
|
||||||
Client::new(
|
Client::new(
|
||||||
config,
|
config,
|
||||||
|
@ -140,7 +140,7 @@ mod test {
|
|||||||
let contract_addr = Address::from_str("0000000000000000000000000000000000000005").unwrap();
|
let contract_addr = Address::from_str("0000000000000000000000000000000000000005").unwrap();
|
||||||
let data = include_bytes!("../res/node_filter.json");
|
let data = include_bytes!("../res/node_filter.json");
|
||||||
let spec = Spec::load(&::std::env::temp_dir(), &data[..]).unwrap();
|
let spec = Spec::load(&::std::env::temp_dir(), &data[..]).unwrap();
|
||||||
let client_db = Arc::new(::kvdb_memorydb::in_memory(::ethcore::db::NUM_COLUMNS.unwrap_or(0)));
|
let client_db = Arc::new(::kvdb_memorydb::create(::ethcore::db::NUM_COLUMNS.unwrap_or(0)));
|
||||||
|
|
||||||
let client = Client::new(
|
let client = Client::new(
|
||||||
ClientConfig::default(),
|
ClientConfig::default(),
|
||||||
|
@ -1480,7 +1480,7 @@ mod tests {
|
|||||||
use rustc_hex::FromHex;
|
use rustc_hex::FromHex;
|
||||||
use hash::keccak;
|
use hash::keccak;
|
||||||
use kvdb::KeyValueDB;
|
use kvdb::KeyValueDB;
|
||||||
use kvdb_memorydb::in_memory;
|
use kvdb_memorydb;
|
||||||
use bigint::hash::*;
|
use bigint::hash::*;
|
||||||
use receipt::{Receipt, TransactionOutcome};
|
use receipt::{Receipt, TransactionOutcome};
|
||||||
use blockchain::{BlockProvider, BlockChain, Config, ImportRoute};
|
use blockchain::{BlockProvider, BlockChain, Config, ImportRoute};
|
||||||
@ -1494,7 +1494,7 @@ mod tests {
|
|||||||
use header::BlockNumber;
|
use header::BlockNumber;
|
||||||
|
|
||||||
fn new_db() -> Arc<KeyValueDB> {
|
fn new_db() -> Arc<KeyValueDB> {
|
||||||
Arc::new(in_memory(::db::NUM_COLUMNS.unwrap_or(0)))
|
Arc::new(kvdb_memorydb::create(::db::NUM_COLUMNS.unwrap_or(0)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_chain(genesis: &[u8], db: Arc<KeyValueDB>) -> BlockChain {
|
fn new_chain(genesis: &[u8], db: Arc<KeyValueDB>) -> BlockChain {
|
||||||
|
@ -127,7 +127,7 @@ impl<'a> EvmTestClient<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn state_from_spec(spec: &'a spec::Spec, factories: &Factories) -> Result<state::State<state_db::StateDB>, EvmTestError> {
|
fn state_from_spec(spec: &'a spec::Spec, factories: &Factories) -> Result<state::State<state_db::StateDB>, EvmTestError> {
|
||||||
let db = Arc::new(kvdb_memorydb::in_memory(db::NUM_COLUMNS.expect("We use column-based DB; qed")));
|
let db = Arc::new(kvdb_memorydb::create(db::NUM_COLUMNS.expect("We use column-based DB; qed")));
|
||||||
let journal_db = journaldb::new(db.clone(), journaldb::Algorithm::EarlyMerge, db::COL_STATE);
|
let journal_db = journaldb::new(db.clone(), journaldb::Algorithm::EarlyMerge, db::COL_STATE);
|
||||||
let mut state_db = state_db::StateDB::new(journal_db, 5 * 1024 * 1024);
|
let mut state_db = state_db::StateDB::new(journal_db, 5 * 1024 * 1024);
|
||||||
state_db = spec.ensure_db_good(state_db, factories)?;
|
state_db = spec.ensure_db_good(state_db, factories)?;
|
||||||
@ -149,7 +149,7 @@ impl<'a> EvmTestClient<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn state_from_pod(spec: &'a spec::Spec, factories: &Factories, pod_state: pod_state::PodState) -> Result<state::State<state_db::StateDB>, EvmTestError> {
|
fn state_from_pod(spec: &'a spec::Spec, factories: &Factories, pod_state: pod_state::PodState) -> Result<state::State<state_db::StateDB>, EvmTestError> {
|
||||||
let db = Arc::new(kvdb_memorydb::in_memory(db::NUM_COLUMNS.expect("We use column-based DB; qed")));
|
let db = Arc::new(kvdb_memorydb::create(db::NUM_COLUMNS.expect("We use column-based DB; qed")));
|
||||||
let journal_db = journaldb::new(db.clone(), journaldb::Algorithm::EarlyMerge, db::COL_STATE);
|
let journal_db = journaldb::new(db.clone(), journaldb::Algorithm::EarlyMerge, db::COL_STATE);
|
||||||
let state_db = state_db::StateDB::new(journal_db, 5 * 1024 * 1024);
|
let state_db = state_db::StateDB::new(journal_db, 5 * 1024 * 1024);
|
||||||
let mut state = state::State::new(
|
let mut state = state::State::new(
|
||||||
|
@ -57,7 +57,7 @@ pub fn json_chain_test(json_data: &[u8]) -> Vec<String> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
{
|
{
|
||||||
let db = Arc::new(::kvdb_memorydb::in_memory(::db::NUM_COLUMNS.unwrap_or(0)));
|
let db = Arc::new(::kvdb_memorydb::create(::db::NUM_COLUMNS.unwrap_or(0)));
|
||||||
let mut config = ClientConfig::default();
|
let mut config = ClientConfig::default();
|
||||||
config.history = 8;
|
config.history = 8;
|
||||||
let client = Client::new(
|
let client = Client::new(
|
||||||
|
@ -238,7 +238,7 @@ fn fixed_to_contract_only() {
|
|||||||
assert_eq!(client.chain_info().best_block_number, 11);
|
assert_eq!(client.chain_info().best_block_number, 11);
|
||||||
let reader = snapshot_helpers::snap(&*client);
|
let reader = snapshot_helpers::snap(&*client);
|
||||||
|
|
||||||
let new_db = kvdb_memorydb::in_memory(::db::NUM_COLUMNS.unwrap_or(0));
|
let new_db = kvdb_memorydb::create(::db::NUM_COLUMNS.unwrap_or(0));
|
||||||
let spec = spec_fixed_to_contract();
|
let spec = spec_fixed_to_contract();
|
||||||
|
|
||||||
// ensure fresh engine's step matches.
|
// ensure fresh engine's step matches.
|
||||||
@ -270,7 +270,7 @@ fn fixed_to_contract_to_contract() {
|
|||||||
|
|
||||||
assert_eq!(client.chain_info().best_block_number, 16);
|
assert_eq!(client.chain_info().best_block_number, 16);
|
||||||
let reader = snapshot_helpers::snap(&*client);
|
let reader = snapshot_helpers::snap(&*client);
|
||||||
let new_db = kvdb_memorydb::in_memory(::db::NUM_COLUMNS.unwrap_or(0));
|
let new_db = kvdb_memorydb::create(::db::NUM_COLUMNS.unwrap_or(0));
|
||||||
let spec = spec_fixed_to_contract();
|
let spec = spec_fixed_to_contract();
|
||||||
|
|
||||||
for _ in 0..16 { spec.engine.step() }
|
for _ in 0..16 { spec.engine.step() }
|
||||||
|
@ -44,7 +44,7 @@ fn chunk_and_restore(amount: u64) {
|
|||||||
let mut snapshot_path = new_path.as_path().to_owned();
|
let mut snapshot_path = new_path.as_path().to_owned();
|
||||||
snapshot_path.push("SNAP");
|
snapshot_path.push("SNAP");
|
||||||
|
|
||||||
let old_db = Arc::new(kvdb_memorydb::in_memory(::db::NUM_COLUMNS.unwrap_or(0)));
|
let old_db = Arc::new(kvdb_memorydb::create(::db::NUM_COLUMNS.unwrap_or(0)));
|
||||||
let bc = BlockChain::new(Default::default(), &genesis, old_db.clone());
|
let bc = BlockChain::new(Default::default(), &genesis, old_db.clone());
|
||||||
|
|
||||||
// build the blockchain.
|
// build the blockchain.
|
||||||
@ -81,7 +81,7 @@ fn chunk_and_restore(amount: u64) {
|
|||||||
writer.into_inner().finish(manifest.clone()).unwrap();
|
writer.into_inner().finish(manifest.clone()).unwrap();
|
||||||
|
|
||||||
// restore it.
|
// restore it.
|
||||||
let new_db = Arc::new(kvdb_memorydb::in_memory(::db::NUM_COLUMNS.unwrap_or(0)));
|
let new_db = Arc::new(kvdb_memorydb::create(::db::NUM_COLUMNS.unwrap_or(0)));
|
||||||
let new_chain = BlockChain::new(Default::default(), &genesis, new_db.clone());
|
let new_chain = BlockChain::new(Default::default(), &genesis, new_db.clone());
|
||||||
let mut rebuilder = SNAPSHOT_MODE.rebuilder(new_chain, new_db.clone(), &manifest).unwrap();
|
let mut rebuilder = SNAPSHOT_MODE.rebuilder(new_chain, new_db.clone(), &manifest).unwrap();
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ fn checks_flag() {
|
|||||||
|
|
||||||
let chunk = stream.out();
|
let chunk = stream.out();
|
||||||
|
|
||||||
let db = Arc::new(kvdb_memorydb::in_memory(::db::NUM_COLUMNS.unwrap_or(0)));
|
let db = Arc::new(kvdb_memorydb::create(::db::NUM_COLUMNS.unwrap_or(0)));
|
||||||
let engine = ::spec::Spec::new_test().engine;
|
let engine = ::spec::Spec::new_test().engine;
|
||||||
let chain = BlockChain::new(Default::default(), &genesis, db.clone());
|
let chain = BlockChain::new(Default::default(), &genesis, db.clone());
|
||||||
|
|
||||||
|
@ -677,7 +677,7 @@ impl Spec {
|
|||||||
|
|
||||||
let factories = Default::default();
|
let factories = Default::default();
|
||||||
let mut db = journaldb::new(
|
let mut db = journaldb::new(
|
||||||
Arc::new(kvdb_memorydb::in_memory(0)),
|
Arc::new(kvdb_memorydb::create(0)),
|
||||||
journaldb::Algorithm::Archive,
|
journaldb::Algorithm::Archive,
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
|
@ -232,7 +232,7 @@ pub fn get_test_client_with_blocks(blocks: Vec<Bytes>) -> Arc<Client> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn new_db() -> Arc<::kvdb::KeyValueDB> {
|
fn new_db() -> Arc<::kvdb::KeyValueDB> {
|
||||||
Arc::new(::kvdb_memorydb::in_memory(::db::NUM_COLUMNS.unwrap_or(0)))
|
Arc::new(::kvdb_memorydb::create(::db::NUM_COLUMNS.unwrap_or(0)))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn generate_dummy_blockchain(block_number: u32) -> BlockChain {
|
pub fn generate_dummy_blockchain(block_number: u32) -> BlockChain {
|
||||||
|
@ -417,7 +417,7 @@ mod tests {
|
|||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::Address;
|
use util::Address;
|
||||||
use kvdb::{DBTransaction, KeyValueDB};
|
use kvdb::{DBTransaction, KeyValueDB};
|
||||||
use kvdb_memorydb::in_memory;
|
use kvdb_memorydb;
|
||||||
use header::BlockNumber;
|
use header::BlockNumber;
|
||||||
use trace::{Config, TraceDB, Database as TraceDatabase, DatabaseExtras, ImportRequest};
|
use trace::{Config, TraceDB, Database as TraceDatabase, DatabaseExtras, ImportRequest};
|
||||||
use trace::{Filter, LocalizedTrace, AddressesFilter, TraceError};
|
use trace::{Filter, LocalizedTrace, AddressesFilter, TraceError};
|
||||||
@ -468,7 +468,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn new_db() -> Arc<KeyValueDB> {
|
fn new_db() -> Arc<KeyValueDB> {
|
||||||
Arc::new(in_memory(::db::NUM_COLUMNS.unwrap_or(0)))
|
Arc::new(kvdb_memorydb::create(::db::NUM_COLUMNS.unwrap_or(0)))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -178,7 +178,7 @@ mod test {
|
|||||||
"#;
|
"#;
|
||||||
|
|
||||||
let spec = Spec::load(&::std::env::temp_dir(), spec_data.as_bytes()).unwrap();
|
let spec = Spec::load(&::std::env::temp_dir(), spec_data.as_bytes()).unwrap();
|
||||||
let client_db = Arc::new(::kvdb_memorydb::in_memory(::db::NUM_COLUMNS.unwrap_or(0)));
|
let client_db = Arc::new(::kvdb_memorydb::create(::db::NUM_COLUMNS.unwrap_or(0)));
|
||||||
|
|
||||||
let client = Client::new(
|
let client = Client::new(
|
||||||
ClientConfig::default(),
|
ClientConfig::default(),
|
||||||
|
@ -245,7 +245,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn twice_empty() {
|
fn twice_empty() {
|
||||||
let db = Arc::new(::kvdb_memorydb::in_memory(0));
|
let db = Arc::new(::kvdb_memorydb::create(0));
|
||||||
|
|
||||||
{
|
{
|
||||||
let store = super::create(db.clone(), None, Dummy(vec![]));
|
let store = super::create(db.clone(), None, Dummy(vec![]));
|
||||||
@ -274,7 +274,7 @@ mod tests {
|
|||||||
PendingTransaction::new(signed, condition)
|
PendingTransaction::new(signed, condition)
|
||||||
}).collect();
|
}).collect();
|
||||||
|
|
||||||
let db = Arc::new(::kvdb_memorydb::in_memory(0));
|
let db = Arc::new(::kvdb_memorydb::create(0));
|
||||||
|
|
||||||
{
|
{
|
||||||
// nothing written yet, will write pending.
|
// nothing written yet, will write pending.
|
||||||
@ -313,7 +313,7 @@ mod tests {
|
|||||||
PendingTransaction::new(signed, None)
|
PendingTransaction::new(signed, None)
|
||||||
});
|
});
|
||||||
|
|
||||||
let db = Arc::new(::kvdb_memorydb::in_memory(0));
|
let db = Arc::new(::kvdb_memorydb::create(0));
|
||||||
{
|
{
|
||||||
// nothing written, will write bad.
|
// nothing written, will write bad.
|
||||||
let store = super::create(db.clone(), None, Dummy(transactions.clone()));
|
let store = super::create(db.clone(), None, Dummy(transactions.clone()));
|
||||||
|
@ -33,7 +33,7 @@ use io::IoChannel;
|
|||||||
use bigint::prelude::U256;
|
use bigint::prelude::U256;
|
||||||
use bigint::hash::H256;
|
use bigint::hash::H256;
|
||||||
use util::Address;
|
use util::Address;
|
||||||
use kvdb_memorydb::in_memory;
|
use kvdb_memorydb;
|
||||||
|
|
||||||
use jsonrpc_core::IoHandler;
|
use jsonrpc_core::IoHandler;
|
||||||
use v1::impls::{EthClient, SigningUnsafeClient};
|
use v1::impls::{EthClient, SigningUnsafeClient};
|
||||||
@ -131,7 +131,7 @@ impl EthTester {
|
|||||||
let client = Client::new(
|
let client = Client::new(
|
||||||
ClientConfig::default(),
|
ClientConfig::default(),
|
||||||
&spec,
|
&spec,
|
||||||
Arc::new(in_memory(::ethcore::db::NUM_COLUMNS.unwrap_or(0))),
|
Arc::new(kvdb_memorydb::create(::ethcore::db::NUM_COLUMNS.unwrap_or(0))),
|
||||||
miner_service.clone(),
|
miner_service.clone(),
|
||||||
IoChannel::disconnected(),
|
IoChannel::disconnected(),
|
||||||
).unwrap();
|
).unwrap();
|
||||||
|
@ -291,7 +291,7 @@ impl TestNet<EthPeer<EthcoreClient>> {
|
|||||||
let client = EthcoreClient::new(
|
let client = EthcoreClient::new(
|
||||||
ClientConfig::default(),
|
ClientConfig::default(),
|
||||||
&spec,
|
&spec,
|
||||||
Arc::new(::kvdb_memorydb::in_memory(::ethcore::db::NUM_COLUMNS.unwrap_or(0))),
|
Arc::new(::kvdb_memorydb::create(::ethcore::db::NUM_COLUMNS.unwrap_or(0))),
|
||||||
Arc::new(Miner::with_spec_and_accounts(&spec, accounts)),
|
Arc::new(Miner::with_spec_and_accounts(&spec, accounts)),
|
||||||
IoChannel::disconnected(),
|
IoChannel::disconnected(),
|
||||||
).unwrap();
|
).unwrap();
|
||||||
|
@ -32,7 +32,7 @@ pub struct InMemory {
|
|||||||
|
|
||||||
/// Create an in-memory database with the given number of columns.
|
/// Create an in-memory database with the given number of columns.
|
||||||
/// Columns will be indexable by 0..`num_cols`
|
/// Columns will be indexable by 0..`num_cols`
|
||||||
pub fn in_memory(num_cols: u32) -> InMemory {
|
pub fn create(num_cols: u32) -> InMemory {
|
||||||
let mut cols = HashMap::new();
|
let mut cols = HashMap::new();
|
||||||
cols.insert(None, BTreeMap::new());
|
cols.insert(None, BTreeMap::new());
|
||||||
|
|
||||||
|
@ -203,12 +203,12 @@ mod tests {
|
|||||||
use hashdb::{HashDB, DBValue};
|
use hashdb::{HashDB, DBValue};
|
||||||
use super::*;
|
use super::*;
|
||||||
use journaldb::traits::JournalDB;
|
use journaldb::traits::JournalDB;
|
||||||
use kvdb_memorydb::in_memory;
|
use kvdb_memorydb;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn insert_same_in_fork() {
|
fn insert_same_in_fork() {
|
||||||
// history is 1
|
// history is 1
|
||||||
let mut jdb = ArchiveDB::new(Arc::new(in_memory(0)), None);
|
let mut jdb = ArchiveDB::new(Arc::new(kvdb_memorydb::create(0)), None);
|
||||||
|
|
||||||
let x = jdb.insert(b"X");
|
let x = jdb.insert(b"X");
|
||||||
jdb.commit_batch(1, &keccak(b"1"), None).unwrap();
|
jdb.commit_batch(1, &keccak(b"1"), None).unwrap();
|
||||||
@ -230,7 +230,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn long_history() {
|
fn long_history() {
|
||||||
// history is 3
|
// history is 3
|
||||||
let mut jdb = ArchiveDB::new(Arc::new(in_memory(0)), None);
|
let mut jdb = ArchiveDB::new(Arc::new(kvdb_memorydb::create(0)), None);
|
||||||
let h = jdb.insert(b"foo");
|
let h = jdb.insert(b"foo");
|
||||||
jdb.commit_batch(0, &keccak(b"0"), None).unwrap();
|
jdb.commit_batch(0, &keccak(b"0"), None).unwrap();
|
||||||
assert!(jdb.contains(&h));
|
assert!(jdb.contains(&h));
|
||||||
@ -248,7 +248,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
#[should_panic]
|
#[should_panic]
|
||||||
fn multiple_owed_removal_not_allowed() {
|
fn multiple_owed_removal_not_allowed() {
|
||||||
let mut jdb = ArchiveDB::new(Arc::new(in_memory(0)), None);
|
let mut jdb = ArchiveDB::new(Arc::new(kvdb_memorydb::create(0)), None);
|
||||||
let h = jdb.insert(b"foo");
|
let h = jdb.insert(b"foo");
|
||||||
jdb.commit_batch(0, &keccak(b"0"), None).unwrap();
|
jdb.commit_batch(0, &keccak(b"0"), None).unwrap();
|
||||||
assert!(jdb.contains(&h));
|
assert!(jdb.contains(&h));
|
||||||
@ -262,7 +262,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn complex() {
|
fn complex() {
|
||||||
// history is 1
|
// history is 1
|
||||||
let mut jdb = ArchiveDB::new(Arc::new(in_memory(0)), None);
|
let mut jdb = ArchiveDB::new(Arc::new(kvdb_memorydb::create(0)), None);
|
||||||
|
|
||||||
let foo = jdb.insert(b"foo");
|
let foo = jdb.insert(b"foo");
|
||||||
let bar = jdb.insert(b"bar");
|
let bar = jdb.insert(b"bar");
|
||||||
@ -294,7 +294,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn fork() {
|
fn fork() {
|
||||||
// history is 1
|
// history is 1
|
||||||
let mut jdb = ArchiveDB::new(Arc::new(in_memory(0)), None);
|
let mut jdb = ArchiveDB::new(Arc::new(kvdb_memorydb::create(0)), None);
|
||||||
|
|
||||||
let foo = jdb.insert(b"foo");
|
let foo = jdb.insert(b"foo");
|
||||||
let bar = jdb.insert(b"bar");
|
let bar = jdb.insert(b"bar");
|
||||||
@ -320,7 +320,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn overwrite() {
|
fn overwrite() {
|
||||||
// history is 1
|
// history is 1
|
||||||
let mut jdb = ArchiveDB::new(Arc::new(in_memory(0)), None);
|
let mut jdb = ArchiveDB::new(Arc::new(kvdb_memorydb::create(0)), None);
|
||||||
|
|
||||||
let foo = jdb.insert(b"foo");
|
let foo = jdb.insert(b"foo");
|
||||||
jdb.commit_batch(0, &keccak(b"0"), None).unwrap();
|
jdb.commit_batch(0, &keccak(b"0"), None).unwrap();
|
||||||
@ -339,7 +339,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn fork_same_key() {
|
fn fork_same_key() {
|
||||||
// history is 1
|
// history is 1
|
||||||
let mut jdb = ArchiveDB::new(Arc::new(in_memory(0)), None);
|
let mut jdb = ArchiveDB::new(Arc::new(kvdb_memorydb::create(0)), None);
|
||||||
jdb.commit_batch(0, &keccak(b"0"), None).unwrap();
|
jdb.commit_batch(0, &keccak(b"0"), None).unwrap();
|
||||||
|
|
||||||
let foo = jdb.insert(b"foo");
|
let foo = jdb.insert(b"foo");
|
||||||
@ -355,7 +355,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn reopen() {
|
fn reopen() {
|
||||||
let shared_db = Arc::new(in_memory(0));
|
let shared_db = Arc::new(kvdb_memorydb::create(0));
|
||||||
let bar = H256::random();
|
let bar = H256::random();
|
||||||
|
|
||||||
let foo = {
|
let foo = {
|
||||||
@ -383,7 +383,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn reopen_remove() {
|
fn reopen_remove() {
|
||||||
let shared_db = Arc::new(in_memory(0));
|
let shared_db = Arc::new(kvdb_memorydb::create(0));
|
||||||
|
|
||||||
let foo = {
|
let foo = {
|
||||||
let mut jdb = ArchiveDB::new(shared_db.clone(), None);
|
let mut jdb = ArchiveDB::new(shared_db.clone(), None);
|
||||||
@ -412,7 +412,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn reopen_fork() {
|
fn reopen_fork() {
|
||||||
let shared_db = Arc::new(in_memory(0));
|
let shared_db = Arc::new(kvdb_memorydb::create(0));
|
||||||
let (foo, _, _) = {
|
let (foo, _, _) = {
|
||||||
let mut jdb = ArchiveDB::new(shared_db.clone(), None);
|
let mut jdb = ArchiveDB::new(shared_db.clone(), None);
|
||||||
// history is 1
|
// history is 1
|
||||||
@ -437,7 +437,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn returns_state() {
|
fn returns_state() {
|
||||||
let shared_db = Arc::new(in_memory(0));
|
let shared_db = Arc::new(kvdb_memorydb::create(0));
|
||||||
|
|
||||||
let key = {
|
let key = {
|
||||||
let mut jdb = ArchiveDB::new(shared_db.clone(), None);
|
let mut jdb = ArchiveDB::new(shared_db.clone(), None);
|
||||||
@ -455,7 +455,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn inject() {
|
fn inject() {
|
||||||
let mut jdb = ArchiveDB::new(Arc::new(in_memory(0)), None);
|
let mut jdb = ArchiveDB::new(Arc::new(kvdb_memorydb::create(0)), None);
|
||||||
let key = jdb.insert(b"dog");
|
let key = jdb.insert(b"dog");
|
||||||
jdb.inject_batch().unwrap();
|
jdb.inject_batch().unwrap();
|
||||||
|
|
||||||
|
@ -552,7 +552,7 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
use super::super::traits::JournalDB;
|
use super::super::traits::JournalDB;
|
||||||
use ethcore_logger::init_log;
|
use ethcore_logger::init_log;
|
||||||
use kvdb_memorydb::in_memory;
|
use kvdb_memorydb;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn insert_same_in_fork() {
|
fn insert_same_in_fork() {
|
||||||
@ -810,13 +810,13 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn new_db() -> EarlyMergeDB {
|
fn new_db() -> EarlyMergeDB {
|
||||||
let backing = Arc::new(in_memory(0));
|
let backing = Arc::new(kvdb_memorydb::create(0));
|
||||||
EarlyMergeDB::new(backing, None)
|
EarlyMergeDB::new(backing, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn reopen() {
|
fn reopen() {
|
||||||
let shared_db = Arc::new(in_memory(0));
|
let shared_db = Arc::new(kvdb_memorydb::create(0));
|
||||||
let bar = H256::random();
|
let bar = H256::random();
|
||||||
|
|
||||||
let foo = {
|
let foo = {
|
||||||
@ -986,7 +986,7 @@ mod tests {
|
|||||||
fn reopen_remove_three() {
|
fn reopen_remove_three() {
|
||||||
init_log();
|
init_log();
|
||||||
|
|
||||||
let shared_db = Arc::new(in_memory(0));
|
let shared_db = Arc::new(kvdb_memorydb::create(0));
|
||||||
let foo = keccak(b"foo");
|
let foo = keccak(b"foo");
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -1039,7 +1039,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn reopen_fork() {
|
fn reopen_fork() {
|
||||||
let shared_db = Arc::new(in_memory(0));
|
let shared_db = Arc::new(kvdb_memorydb::create(0));
|
||||||
|
|
||||||
let (foo, bar, baz) = {
|
let (foo, bar, baz) = {
|
||||||
let mut jdb = EarlyMergeDB::new(shared_db.clone(), None);
|
let mut jdb = EarlyMergeDB::new(shared_db.clone(), None);
|
||||||
|
@ -460,10 +460,10 @@ mod tests {
|
|||||||
use hashdb::{HashDB, DBValue};
|
use hashdb::{HashDB, DBValue};
|
||||||
use ethcore_logger::init_log;
|
use ethcore_logger::init_log;
|
||||||
use journaldb::JournalDB;
|
use journaldb::JournalDB;
|
||||||
use kvdb_memorydb::in_memory;
|
use kvdb_memorydb;
|
||||||
|
|
||||||
fn new_db() -> OverlayRecentDB {
|
fn new_db() -> OverlayRecentDB {
|
||||||
let backing = Arc::new(in_memory(0));
|
let backing = Arc::new(kvdb_memorydb::create(0));
|
||||||
OverlayRecentDB::new(backing, None)
|
OverlayRecentDB::new(backing, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,7 +705,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn reopen() {
|
fn reopen() {
|
||||||
let shared_db = Arc::new(in_memory(0));
|
let shared_db = Arc::new(kvdb_memorydb::create(0));
|
||||||
let bar = H256::random();
|
let bar = H256::random();
|
||||||
|
|
||||||
let foo = {
|
let foo = {
|
||||||
@ -872,7 +872,7 @@ mod tests {
|
|||||||
fn reopen_remove_three() {
|
fn reopen_remove_three() {
|
||||||
init_log();
|
init_log();
|
||||||
|
|
||||||
let shared_db = Arc::new(in_memory(0));
|
let shared_db = Arc::new(kvdb_memorydb::create(0));
|
||||||
let foo = keccak(b"foo");
|
let foo = keccak(b"foo");
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -925,7 +925,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn reopen_fork() {
|
fn reopen_fork() {
|
||||||
let shared_db = Arc::new(in_memory(0));
|
let shared_db = Arc::new(kvdb_memorydb::create(0));
|
||||||
|
|
||||||
let (foo, bar, baz) = {
|
let (foo, bar, baz) = {
|
||||||
let mut jdb = OverlayRecentDB::new(shared_db.clone(), None);
|
let mut jdb = OverlayRecentDB::new(shared_db.clone(), None);
|
||||||
@ -990,7 +990,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn earliest_era() {
|
fn earliest_era() {
|
||||||
let shared_db = Arc::new(in_memory(0));
|
let shared_db = Arc::new(kvdb_memorydb::create(0));
|
||||||
|
|
||||||
// empty DB
|
// empty DB
|
||||||
let mut jdb = OverlayRecentDB::new(shared_db.clone(), None);
|
let mut jdb = OverlayRecentDB::new(shared_db.clone(), None);
|
||||||
|
@ -210,12 +210,12 @@ mod tests {
|
|||||||
|
|
||||||
use keccak::keccak;
|
use keccak::keccak;
|
||||||
use hashdb::{HashDB, DBValue};
|
use hashdb::{HashDB, DBValue};
|
||||||
use kvdb_memorydb::in_memory;
|
use kvdb_memorydb;
|
||||||
use super::*;
|
use super::*;
|
||||||
use super::super::traits::JournalDB;
|
use super::super::traits::JournalDB;
|
||||||
|
|
||||||
fn new_db() -> RefCountedDB {
|
fn new_db() -> RefCountedDB {
|
||||||
let backing = Arc::new(in_memory(0));
|
let backing = Arc::new(kvdb_memorydb::create(0));
|
||||||
RefCountedDB::new(backing, None)
|
RefCountedDB::new(backing, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ impl OverlayDB {
|
|||||||
/// Create a new instance of OverlayDB with an anonymous temporary database.
|
/// Create a new instance of OverlayDB with an anonymous temporary database.
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub fn new_temp() -> OverlayDB {
|
pub fn new_temp() -> OverlayDB {
|
||||||
let backing = Arc::new(::kvdb_memorydb::in_memory(0));
|
let backing = Arc::new(::kvdb_memorydb::create(0));
|
||||||
Self::new(backing, None)
|
Self::new(backing, None)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user