renamed kvdb_memorydb::in_memory -> kvdb_memorydb::create

This commit is contained in:
debris 2017-10-15 16:17:15 +02:00
parent d88ec35a6a
commit 616cafb04a
21 changed files with 53 additions and 53 deletions

View File

@ -729,13 +729,13 @@ mod tests {
use ethcore::spec::Spec;
use cache::Cache;
use kvdb::KeyValueDB;
use kvdb_memorydb::in_memory;
use kvdb_memorydb;
use time::Duration;
use parking_lot::Mutex;
fn make_db() -> Arc<KeyValueDB> {
Arc::new(in_memory(0))
Arc::new(kvdb_memorydb::create(0))
}
#[test]

View File

@ -215,7 +215,7 @@ impl<T: ChainDataFetcher> Client<T> {
io_channel: IoChannel<ClientIoMessage>,
cache: Arc<Mutex<Cache>>
) -> Self {
let db = ::kvdb_memorydb::in_memory(0);
let db = ::kvdb_memorydb::create(0);
Client::new(
config,

View File

@ -140,7 +140,7 @@ mod test {
let contract_addr = Address::from_str("0000000000000000000000000000000000000005").unwrap();
let data = include_bytes!("../res/node_filter.json");
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(
ClientConfig::default(),

View File

@ -1480,7 +1480,7 @@ mod tests {
use rustc_hex::FromHex;
use hash::keccak;
use kvdb::KeyValueDB;
use kvdb_memorydb::in_memory;
use kvdb_memorydb;
use bigint::hash::*;
use receipt::{Receipt, TransactionOutcome};
use blockchain::{BlockProvider, BlockChain, Config, ImportRoute};
@ -1494,7 +1494,7 @@ mod tests {
use header::BlockNumber;
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 {

View File

@ -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> {
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 mut state_db = state_db::StateDB::new(journal_db, 5 * 1024 * 1024);
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> {
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 state_db = state_db::StateDB::new(journal_db, 5 * 1024 * 1024);
let mut state = state::State::new(

View File

@ -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();
config.history = 8;
let client = Client::new(

View File

@ -238,7 +238,7 @@ fn fixed_to_contract_only() {
assert_eq!(client.chain_info().best_block_number, 11);
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();
// 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);
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();
for _ in 0..16 { spec.engine.step() }

View File

@ -44,7 +44,7 @@ fn chunk_and_restore(amount: u64) {
let mut snapshot_path = new_path.as_path().to_owned();
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());
// build the blockchain.
@ -81,7 +81,7 @@ fn chunk_and_restore(amount: u64) {
writer.into_inner().finish(manifest.clone()).unwrap();
// 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 mut rebuilder = SNAPSHOT_MODE.rebuilder(new_chain, new_db.clone(), &manifest).unwrap();
@ -128,7 +128,7 @@ fn checks_flag() {
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 chain = BlockChain::new(Default::default(), &genesis, db.clone());

View File

@ -677,7 +677,7 @@ impl Spec {
let factories = Default::default();
let mut db = journaldb::new(
Arc::new(kvdb_memorydb::in_memory(0)),
Arc::new(kvdb_memorydb::create(0)),
journaldb::Algorithm::Archive,
None,
);

View File

@ -232,7 +232,7 @@ pub fn get_test_client_with_blocks(blocks: Vec<Bytes>) -> Arc<Client> {
}
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 {

View File

@ -417,7 +417,7 @@ mod tests {
use bigint::hash::H256;
use util::Address;
use kvdb::{DBTransaction, KeyValueDB};
use kvdb_memorydb::in_memory;
use kvdb_memorydb;
use header::BlockNumber;
use trace::{Config, TraceDB, Database as TraceDatabase, DatabaseExtras, ImportRequest};
use trace::{Filter, LocalizedTrace, AddressesFilter, TraceError};
@ -468,7 +468,7 @@ mod tests {
}
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]

View File

@ -178,7 +178,7 @@ mod test {
"#;
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(
ClientConfig::default(),

View File

@ -245,7 +245,7 @@ mod tests {
#[test]
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![]));
@ -274,7 +274,7 @@ mod tests {
PendingTransaction::new(signed, condition)
}).collect();
let db = Arc::new(::kvdb_memorydb::in_memory(0));
let db = Arc::new(::kvdb_memorydb::create(0));
{
// nothing written yet, will write pending.
@ -313,7 +313,7 @@ mod tests {
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.
let store = super::create(db.clone(), None, Dummy(transactions.clone()));

View File

@ -33,7 +33,7 @@ use io::IoChannel;
use bigint::prelude::U256;
use bigint::hash::H256;
use util::Address;
use kvdb_memorydb::in_memory;
use kvdb_memorydb;
use jsonrpc_core::IoHandler;
use v1::impls::{EthClient, SigningUnsafeClient};
@ -131,7 +131,7 @@ impl EthTester {
let client = Client::new(
ClientConfig::default(),
&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(),
IoChannel::disconnected(),
).unwrap();

View File

@ -291,7 +291,7 @@ impl TestNet<EthPeer<EthcoreClient>> {
let client = EthcoreClient::new(
ClientConfig::default(),
&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)),
IoChannel::disconnected(),
).unwrap();

View File

@ -32,7 +32,7 @@ pub struct InMemory {
/// Create an in-memory database with the given number of columns.
/// 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();
cols.insert(None, BTreeMap::new());

View File

@ -203,12 +203,12 @@ mod tests {
use hashdb::{HashDB, DBValue};
use super::*;
use journaldb::traits::JournalDB;
use kvdb_memorydb::in_memory;
use kvdb_memorydb;
#[test]
fn insert_same_in_fork() {
// 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");
jdb.commit_batch(1, &keccak(b"1"), None).unwrap();
@ -230,7 +230,7 @@ mod tests {
#[test]
fn long_history() {
// 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");
jdb.commit_batch(0, &keccak(b"0"), None).unwrap();
assert!(jdb.contains(&h));
@ -248,7 +248,7 @@ mod tests {
#[test]
#[should_panic]
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");
jdb.commit_batch(0, &keccak(b"0"), None).unwrap();
assert!(jdb.contains(&h));
@ -262,7 +262,7 @@ mod tests {
#[test]
fn complex() {
// 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 bar = jdb.insert(b"bar");
@ -294,7 +294,7 @@ mod tests {
#[test]
fn fork() {
// 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 bar = jdb.insert(b"bar");
@ -320,7 +320,7 @@ mod tests {
#[test]
fn overwrite() {
// 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");
jdb.commit_batch(0, &keccak(b"0"), None).unwrap();
@ -339,7 +339,7 @@ mod tests {
#[test]
fn fork_same_key() {
// 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();
let foo = jdb.insert(b"foo");
@ -355,7 +355,7 @@ mod tests {
#[test]
fn reopen() {
let shared_db = Arc::new(in_memory(0));
let shared_db = Arc::new(kvdb_memorydb::create(0));
let bar = H256::random();
let foo = {
@ -383,7 +383,7 @@ mod tests {
#[test]
fn reopen_remove() {
let shared_db = Arc::new(in_memory(0));
let shared_db = Arc::new(kvdb_memorydb::create(0));
let foo = {
let mut jdb = ArchiveDB::new(shared_db.clone(), None);
@ -412,7 +412,7 @@ mod tests {
#[test]
fn reopen_fork() {
let shared_db = Arc::new(in_memory(0));
let shared_db = Arc::new(kvdb_memorydb::create(0));
let (foo, _, _) = {
let mut jdb = ArchiveDB::new(shared_db.clone(), None);
// history is 1
@ -437,7 +437,7 @@ mod tests {
#[test]
fn returns_state() {
let shared_db = Arc::new(in_memory(0));
let shared_db = Arc::new(kvdb_memorydb::create(0));
let key = {
let mut jdb = ArchiveDB::new(shared_db.clone(), None);
@ -455,7 +455,7 @@ mod tests {
#[test]
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");
jdb.inject_batch().unwrap();

View File

@ -552,7 +552,7 @@ mod tests {
use super::*;
use super::super::traits::JournalDB;
use ethcore_logger::init_log;
use kvdb_memorydb::in_memory;
use kvdb_memorydb;
#[test]
fn insert_same_in_fork() {
@ -810,13 +810,13 @@ mod tests {
}
fn new_db() -> EarlyMergeDB {
let backing = Arc::new(in_memory(0));
let backing = Arc::new(kvdb_memorydb::create(0));
EarlyMergeDB::new(backing, None)
}
#[test]
fn reopen() {
let shared_db = Arc::new(in_memory(0));
let shared_db = Arc::new(kvdb_memorydb::create(0));
let bar = H256::random();
let foo = {
@ -986,7 +986,7 @@ mod tests {
fn reopen_remove_three() {
init_log();
let shared_db = Arc::new(in_memory(0));
let shared_db = Arc::new(kvdb_memorydb::create(0));
let foo = keccak(b"foo");
{
@ -1039,7 +1039,7 @@ mod tests {
#[test]
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 mut jdb = EarlyMergeDB::new(shared_db.clone(), None);

View File

@ -460,10 +460,10 @@ mod tests {
use hashdb::{HashDB, DBValue};
use ethcore_logger::init_log;
use journaldb::JournalDB;
use kvdb_memorydb::in_memory;
use kvdb_memorydb;
fn new_db() -> OverlayRecentDB {
let backing = Arc::new(in_memory(0));
let backing = Arc::new(kvdb_memorydb::create(0));
OverlayRecentDB::new(backing, None)
}
@ -705,7 +705,7 @@ mod tests {
#[test]
fn reopen() {
let shared_db = Arc::new(in_memory(0));
let shared_db = Arc::new(kvdb_memorydb::create(0));
let bar = H256::random();
let foo = {
@ -872,7 +872,7 @@ mod tests {
fn reopen_remove_three() {
init_log();
let shared_db = Arc::new(in_memory(0));
let shared_db = Arc::new(kvdb_memorydb::create(0));
let foo = keccak(b"foo");
{
@ -925,7 +925,7 @@ mod tests {
#[test]
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 mut jdb = OverlayRecentDB::new(shared_db.clone(), None);
@ -990,7 +990,7 @@ mod tests {
#[test]
fn earliest_era() {
let shared_db = Arc::new(in_memory(0));
let shared_db = Arc::new(kvdb_memorydb::create(0));
// empty DB
let mut jdb = OverlayRecentDB::new(shared_db.clone(), None);

View File

@ -210,12 +210,12 @@ mod tests {
use keccak::keccak;
use hashdb::{HashDB, DBValue};
use kvdb_memorydb::in_memory;
use kvdb_memorydb;
use super::*;
use super::super::traits::JournalDB;
fn new_db() -> RefCountedDB {
let backing = Arc::new(in_memory(0));
let backing = Arc::new(kvdb_memorydb::create(0));
RefCountedDB::new(backing, None)
}

View File

@ -50,7 +50,7 @@ impl OverlayDB {
/// Create a new instance of OverlayDB with an anonymous temporary database.
#[cfg(test)]
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)
}