simplify compression and move it out of rlp crate (#7957)

* simplify compression and move it out of rlp crate

* removed lazy_static dependency from rlp
This commit is contained in:
Marek Kotewicz 2018-02-23 10:12:52 +01:00 committed by Rando
parent a255f9f52c
commit 1cd8e2a068
2 changed files with 0 additions and 11 deletions

View File

@ -5,5 +5,4 @@ authors = ["Parity Technologies <admin@parity.io>"]
[dependencies]
parking_lot = "0.5"
rlp = { path = "../rlp" }
kvdb = { path = "../kvdb" }

View File

@ -16,12 +16,10 @@
extern crate parking_lot;
extern crate kvdb;
extern crate rlp;
use std::collections::{BTreeMap, HashMap};
use parking_lot::RwLock;
use kvdb::{DBValue, DBTransaction, KeyValueDB, DBOp, Result};
use rlp::{RlpType, UntrustedRlp, Compressible};
/// A key-value database fulfilling the `KeyValueDB` trait, living in memory.
/// This is generally intended for tests and is not particularly optimized.
@ -75,14 +73,6 @@ impl KeyValueDB for InMemory {
col.insert(key.into_vec(), value);
}
},
DBOp::InsertCompressed { col, key, value } => {
if let Some(col) = columns.get_mut(&col) {
let compressed = UntrustedRlp::new(&value).compress(RlpType::Blocks);
let mut value = DBValue::new();
value.append_slice(&compressed);
col.insert(key.into_vec(), value);
}
},
DBOp::Delete { col, key } => {
if let Some(col) = columns.get_mut(&col) {
col.remove(&*key);