Merge pull request #6322 from paritytech/itertools
Itertools are no longer reexported from util, optimized triedb iter
This commit is contained in:
commit
6f03c2bfd1
3
Cargo.lock
generated
3
Cargo.lock
generated
@ -776,7 +776,6 @@ dependencies = [
|
||||
"ethcore-devtools 1.8.0",
|
||||
"ethcore-logger 1.8.0",
|
||||
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lru-cache 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1863,6 +1862,7 @@ dependencies = [
|
||||
"fetch 0.1.0",
|
||||
"futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures-cpupool 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)",
|
||||
"jsonrpc-http-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)",
|
||||
"linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1974,6 +1974,7 @@ dependencies = [
|
||||
"fetch 0.1.0",
|
||||
"futures 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures-cpupool 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itertools 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"jsonrpc-core 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)",
|
||||
"jsonrpc-http-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)",
|
||||
"jsonrpc-ipc-server 7.0.0 (git+https://github.com/paritytech/jsonrpc.git?branch=parity-1.7)",
|
||||
|
@ -27,6 +27,7 @@ time = "0.1.35"
|
||||
unicase = "1.3"
|
||||
url = "1.0"
|
||||
zip = { version = "0.1", default-features = false }
|
||||
itertools = "0.5"
|
||||
|
||||
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.7" }
|
||||
jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.7" }
|
||||
|
@ -31,8 +31,7 @@ pub use self::redirect::Redirection;
|
||||
pub use self::streaming::StreamingHandler;
|
||||
|
||||
use std::iter;
|
||||
use util::Itertools;
|
||||
|
||||
use itertools::Itertools;
|
||||
use url::Url;
|
||||
use hyper::{server, header, net, uri};
|
||||
use {apps, address, Embeddable};
|
||||
|
@ -22,6 +22,7 @@
|
||||
extern crate base32;
|
||||
extern crate futures;
|
||||
extern crate futures_cpupool;
|
||||
extern crate itertools;
|
||||
extern crate linked_hash_map;
|
||||
extern crate mime_guess;
|
||||
extern crate ntp;
|
||||
|
@ -19,6 +19,7 @@
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::sync::Arc;
|
||||
use std::mem;
|
||||
use itertools::Itertools;
|
||||
use bloomchain as bc;
|
||||
use util::*;
|
||||
use rlp::*;
|
||||
|
@ -20,9 +20,10 @@ use std::sync::{Arc, Weak};
|
||||
use std::sync::atomic::{AtomicUsize, AtomicBool, Ordering as AtomicOrdering};
|
||||
use std::time::{Instant};
|
||||
use time::precise_time_ns;
|
||||
use itertools::Itertools;
|
||||
|
||||
// util
|
||||
use util::{Bytes, PerfTimer, Itertools, Mutex, RwLock, MutexGuard, Hashable};
|
||||
use util::{Bytes, PerfTimer, Mutex, RwLock, MutexGuard, Hashable};
|
||||
use util::{journaldb, DBValue, TrieFactory, Trie};
|
||||
use util::{U256, H256, Address, H2048};
|
||||
use util::trie::TrieSpec;
|
||||
|
@ -20,6 +20,7 @@ use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrder};
|
||||
use std::sync::Arc;
|
||||
use std::collections::{HashMap, BTreeMap};
|
||||
use std::mem;
|
||||
use itertools::Itertools;
|
||||
use rustc_hex::FromHex;
|
||||
use util::*;
|
||||
use rlp::*;
|
||||
|
@ -15,6 +15,7 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use itertools::Itertools;
|
||||
|
||||
use block::{OpenBlock, SealedBlock, ClosedBlock};
|
||||
use blockchain::TreeRoute;
|
||||
@ -33,7 +34,7 @@ use trace::LocalizedTrace;
|
||||
use transaction::{LocalizedTransaction, PendingTransaction, SignedTransaction};
|
||||
use verification::queue::QueueInfo as BlockQueueInfo;
|
||||
|
||||
use util::{U256, Address, H256, H2048, Bytes, Itertools};
|
||||
use util::{U256, Address, H256, H2048, Bytes};
|
||||
use util::hashdb::DBValue;
|
||||
|
||||
use types::ids::*;
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
use std::fmt;
|
||||
use std::collections::BTreeMap;
|
||||
use itertools::Itertools;
|
||||
use util::*;
|
||||
use state::Account;
|
||||
use ethjson;
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
use std::fmt;
|
||||
use std::collections::BTreeMap;
|
||||
use itertools::Itertools;
|
||||
use util::*;
|
||||
use pod_account::{self, PodAccount};
|
||||
use types::state_diff::StateDiff;
|
||||
|
@ -24,6 +24,7 @@ serde_json = "1.0"
|
||||
time = "0.1"
|
||||
tokio-timer = "0.1"
|
||||
transient-hashmap = "0.4"
|
||||
itertools = "0.5"
|
||||
|
||||
jsonrpc-core = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.7" }
|
||||
jsonrpc-http-server = { git = "https://github.com/paritytech/jsonrpc.git", branch = "parity-1.7" }
|
||||
|
@ -18,9 +18,10 @@ use std::io::{self, Read, Write};
|
||||
use std::path::Path;
|
||||
use std::{fs, time, mem};
|
||||
|
||||
use itertools::Itertools;
|
||||
use rand::Rng;
|
||||
use rand::os::OsRng;
|
||||
use util::{H256, Hashable, Itertools};
|
||||
use util::{H256, Hashable};
|
||||
|
||||
/// Providing current time in seconds
|
||||
pub trait TimeProvider {
|
||||
|
@ -24,6 +24,7 @@ extern crate cid;
|
||||
extern crate crypto as rust_crypto;
|
||||
extern crate futures;
|
||||
extern crate futures_cpupool;
|
||||
extern crate itertools;
|
||||
extern crate multihash;
|
||||
extern crate order_stat;
|
||||
extern crate rand;
|
||||
|
@ -19,7 +19,6 @@ rust-crypto = "0.2.34"
|
||||
elastic-array = "0.9"
|
||||
rlp = { path = "rlp" }
|
||||
heapsize = "0.4"
|
||||
itertools = "0.5"
|
||||
sha3 = { path = "sha3" }
|
||||
clippy = { version = "0.0.103", optional = true}
|
||||
ethcore-devtools = { path = "../devtools" }
|
||||
|
@ -45,14 +45,14 @@ fn random_bytes(min_count: usize, diff_count: usize, seed: &mut H256) -> Vec<u8>
|
||||
assert!(min_count + diff_count <= 32);
|
||||
*seed = seed.sha3();
|
||||
let r = min_count + (seed[31] as usize % (diff_count + 1));
|
||||
seed[0..r].into_vec()
|
||||
seed[0..r].to_vec()
|
||||
}
|
||||
|
||||
fn random_value(seed: &mut H256) -> Bytes {
|
||||
*seed = seed.sha3();
|
||||
match seed[0] % 2 {
|
||||
1 => vec![seed[31];1],
|
||||
_ => seed.into_vec(),
|
||||
_ => seed.to_vec(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@ use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use parking_lot::RwLock;
|
||||
use heapsize::HeapSizeOf;
|
||||
use itertools::Itertools;
|
||||
use rlp::*;
|
||||
use hashdb::*;
|
||||
use memorydb::*;
|
||||
@ -432,7 +431,9 @@ impl JournalDB for EarlyMergeDB {
|
||||
// - we write the key into our journal for this block;
|
||||
|
||||
r.begin_list(inserts.len());
|
||||
inserts.iter().foreach(|&(k, _)| {r.append(&k);});
|
||||
for &(k, _) in &inserts {
|
||||
r.append(&k);
|
||||
}
|
||||
r.append_list(&removes);
|
||||
Self::insert_keys(&inserts, &*self.backing, self.column, &mut refs, batch, trace);
|
||||
|
||||
|
@ -106,7 +106,6 @@ extern crate rlp;
|
||||
extern crate regex;
|
||||
extern crate lru_cache;
|
||||
extern crate heapsize;
|
||||
extern crate itertools;
|
||||
extern crate ethcore_logger;
|
||||
|
||||
#[macro_use]
|
||||
@ -153,7 +152,6 @@ 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
|
||||
|
@ -15,7 +15,6 @@
|
||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use std::fmt;
|
||||
use itertools::Itertools;
|
||||
use hashdb::*;
|
||||
use nibbleslice::*;
|
||||
use rlp::*;
|
||||
@ -293,7 +292,15 @@ impl<'a> TrieDBIterator<'a> {
|
||||
/// The present key.
|
||||
fn key(&self) -> Bytes {
|
||||
// collapse the key_nibbles down to bytes.
|
||||
self.key_nibbles.iter().step(2).zip(self.key_nibbles.iter().skip(1).step(2)).map(|(h, l)| h * 16 + l).collect()
|
||||
let nibbles = &self.key_nibbles;
|
||||
let mut i = 1;
|
||||
let mut result = Bytes::with_capacity(nibbles.len() / 2);
|
||||
let len = nibbles.len();
|
||||
while i < len {
|
||||
result.push(nibbles[i - 1] * 16 + nibbles[i]);
|
||||
i += 2;
|
||||
}
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user