removed util::common

This commit is contained in:
debris
2017-07-29 21:56:42 +02:00
parent eecd823d32
commit c4989ddc44
52 changed files with 109 additions and 84 deletions

View File

@@ -17,13 +17,6 @@
//! Utils common types and macros global reexport.
use std::io;
pub use standard::*;
pub use error::*;
pub use bytes::*;
pub use vector::*;
pub use sha3::*;
pub use bigint::prelude::*;
pub use bigint::hash;
#[macro_export]
macro_rules! vec_into {
@@ -89,8 +82,8 @@ macro_rules! map_into {
#[macro_export]
macro_rules! flush {
($arg:expr) => ($crate::flush($arg.into()));
($($arg:tt)*) => ($crate::flush(format!("{}", format_args!($($arg)*))));
($arg:expr) => ($crate::common::flush($arg.into()));
($($arg:tt)*) => ($crate::common::flush(format!("{}", format_args!($($arg)*))));
}
#[macro_export]

View File

@@ -19,7 +19,7 @@
use rustc_hex::FromHexError;
use rlp::DecoderError;
use std::fmt;
use hash::H256;
use bigint::hash::H256;
#[derive(Debug)]
/// Error in database subsystem.

View File

@@ -17,13 +17,14 @@
//! Disk-backed `HashDB` implementation.
use std::collections::HashMap;
use common::*;
use std::sync::Arc;
use rlp::*;
use hashdb::*;
use memorydb::*;
use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
use super::traits::JournalDB;
use kvdb::{KeyValueDB, DBTransaction};
use {Bytes, H256, BaseDataError, UtilError};
/// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay
/// and latent-removal semantics.
@@ -197,11 +198,12 @@ mod tests {
#![cfg_attr(feature="dev", allow(blacklisted_name))]
#![cfg_attr(feature="dev", allow(similar_names))]
use common::*;
use std::path::Path;
use hashdb::{HashDB, DBValue};
use super::*;
use journaldb::traits::JournalDB;
use kvdb::Database;
use {Hashable, H32};
#[test]
fn insert_same_in_fork() {

View File

@@ -18,13 +18,17 @@
use std::fmt;
use std::collections::HashMap;
use common::*;
use std::sync::Arc;
use parking_lot::RwLock;
use heapsize::HeapSizeOf;
use itertools::Itertools;
use rlp::*;
use hashdb::*;
use memorydb::*;
use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
use super::traits::JournalDB;
use kvdb::{KeyValueDB, DBTransaction};
use {H256, BaseDataError, UtilError, Bytes};
#[derive(Clone, PartialEq, Eq)]
struct RefInfo {
@@ -551,12 +555,13 @@ mod tests {
#![cfg_attr(feature="dev", allow(blacklisted_name))]
#![cfg_attr(feature="dev", allow(similar_names))]
use common::*;
use std::path::Path;
use hashdb::{HashDB, DBValue};
use super::*;
use super::super::traits::JournalDB;
use ethcore_logger::init_log;
use kvdb::{DatabaseConfig};
use {Hashable, H32};
#[test]
fn insert_same_in_fork() {

View File

@@ -17,7 +17,7 @@
//! `JournalDB` interface and implementation.
use std::{fmt, str};
use common::*;
use std::sync::Arc;
/// Export the journaldb module.
pub mod traits;

View File

@@ -17,13 +17,16 @@
//! `JournalDB` over in-memory overlay
use std::collections::HashMap;
use common::*;
use std::sync::Arc;
use parking_lot::RwLock;
use heapsize::HeapSizeOf;
use rlp::*;
use hashdb::*;
use memorydb::*;
use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
use kvdb::{KeyValueDB, DBTransaction};
use super::JournalDB;
use {H256, BaseDataError, UtilError, Bytes, H256FastMap};
/// Implementation of the `JournalDB` trait for a disk-backed database with a memory overlay
/// and, possibly, latent-removal semantics.
@@ -451,12 +454,13 @@ mod tests {
#![cfg_attr(feature="dev", allow(blacklisted_name))]
#![cfg_attr(feature="dev", allow(similar_names))]
use common::*;
use std::path::Path;
use super::*;
use hashdb::{HashDB, DBValue};
use ethcore_logger::init_log;
use journaldb::JournalDB;
use kvdb::Database;
use {H32, Hashable};
fn new_db(path: &Path) -> OverlayRecentDB {
let backing = Arc::new(Database::open_default(path.to_str().unwrap()).unwrap());

View File

@@ -17,7 +17,8 @@
//! Disk-backed, ref-counted `JournalDB` implementation.
use std::collections::HashMap;
use common::*;
use std::sync::Arc;
use heapsize::HeapSizeOf;
use rlp::*;
use hashdb::*;
use overlaydb::OverlayDB;
@@ -25,6 +26,7 @@ use memorydb::MemoryDB;
use super::{DB_PREFIX_LEN, LATEST_ERA_KEY};
use super::traits::JournalDB;
use kvdb::{KeyValueDB, DBTransaction};
use {UtilError, H256, Bytes};
/// Implementation of the `HashDB` trait for a disk-backed database with a memory overlay
/// and latent-removal semantics.
@@ -211,10 +213,10 @@ mod tests {
#![cfg_attr(feature="dev", allow(blacklisted_name))]
#![cfg_attr(feature="dev", allow(similar_names))]
use common::*;
use hashdb::{HashDB, DBValue};
use super::*;
use super::super::traits::JournalDB;
use {Hashable};
#[test]
fn long_history() {

View File

@@ -16,9 +16,10 @@
//! Disk-backed `HashDB` implementation.
use common::*;
use std::sync::Arc;
use hashdb::*;
use kvdb::{self, DBTransaction};
use {Bytes, H256, UtilError};
/// A `HashDB` which can manage a short-term journal potentially containing many forks of mutually
/// exclusive actions.

View File

@@ -20,14 +20,17 @@ use std::{mem, fs};
use std::collections::{HashMap, BTreeMap};
use std::io::ErrorKind;
use std::marker::PhantomData;
use std::path::PathBuf;
use std::path::{PathBuf, Path};
use parking_lot::{Mutex, MutexGuard, RwLock};
use common::*;
use elastic_array::*;
use hashdb::DBValue;
use rlp::{UntrustedRlp, RlpType, Compressible};
use rocksdb::{DB, Writable, WriteBatch, WriteOptions, IteratorMode, DBIterator,
Options, DBCompactionStyle, BlockBasedOptions, Direction, Cache, Column, ReadOptions};
use {UtilError, Bytes};
#[cfg(target_os = "linux")]
use regex::Regex;
#[cfg(target_os = "linux")]

View File

@@ -112,7 +112,6 @@ extern crate ethcore_logger;
#[macro_use]
extern crate log as rlog;
pub mod standard;
#[macro_use]
pub mod common;
pub mod error;
@@ -135,7 +134,6 @@ pub mod snappy;
pub mod cache;
mod timer;
pub use common::*;
pub use misc::*;
pub use hashdb::*;
pub use memorydb::MemoryDB;
@@ -146,7 +144,17 @@ pub use trie::{Trie, TrieMut, TrieDB, TrieDBMut, TrieFactory, TrieError, SecTrie
pub use semantic_version::*;
pub use kvdb::*;
pub use timer::*;
pub use error::*;
pub use bytes::*;
pub use vector::*;
pub use sha3::*;
pub use bigint::prelude::*;
pub use bigint::hash;
pub use ansi_term::{Colour, Style};
pub use heapsize::HeapSizeOf;
pub use itertools::Itertools;
pub use parking_lot::{Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard};
/// 160-bit integer representing account address
pub type Address = H160;

View File

@@ -19,12 +19,11 @@
//! are performed in temp sub-directories.
use std::collections::BTreeMap;
use common::*;
use std::sync::Arc;
use std::path::{Path, PathBuf};
use migration::{Batch, Config, Error, SimpleMigration, Migration, Manager};
use kvdb::Database;
use devtools::RandomTempPath;
use std::path::PathBuf;
fn db_path(path: &Path) -> PathBuf {
let mut p = path.to_owned();

View File

@@ -16,9 +16,9 @@
//! Diff misc.
use common::*;
use rlp::RlpStream;
use target_info::Target;
use Bytes;
include!(concat!(env!("OUT_DIR"), "/version.rs"));
include!(concat!(env!("OUT_DIR"), "/rustc_version.rs"));

View File

@@ -1,27 +0,0 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
//! Std lib global reexports.
pub use std::path::Path;
pub use std::hash::{Hash, Hasher};
pub use std::sync::Arc;
pub use heapsize::HeapSizeOf;
pub use itertools::Itertools;
pub use parking_lot::{Condvar, Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard};

View File

@@ -15,13 +15,14 @@
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
use std::fmt;
use common::*;
use itertools::Itertools;
use hashdb::*;
use nibbleslice::*;
use rlp::*;
use super::node::{Node, OwnedNode};
use super::lookup::Lookup;
use super::{Trie, TrieItem, TrieError, TrieIterator, Query};
use {ToPretty, Bytes, H256};
/// A `Trie` implementation using a generic `HashDB` backing database.
///