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:
parent
269f95ad9c
commit
fb4c561411
19
src/lib.rs
19
src/lib.rs
|
@ -56,11 +56,6 @@ pub enum DBOp {
|
|||
key: ElasticArray32<u8>,
|
||||
value: DBValue,
|
||||
},
|
||||
InsertCompressed {
|
||||
col: Option<u32>,
|
||||
key: ElasticArray32<u8>,
|
||||
value: DBValue,
|
||||
},
|
||||
Delete {
|
||||
col: Option<u32>,
|
||||
key: ElasticArray32<u8>,
|
||||
|
@ -72,7 +67,6 @@ impl DBOp {
|
|||
pub fn key(&self) -> &[u8] {
|
||||
match *self {
|
||||
DBOp::Insert { ref key, .. } => key,
|
||||
DBOp::InsertCompressed { ref key, .. } => key,
|
||||
DBOp::Delete { ref key, .. } => key,
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +75,6 @@ impl DBOp {
|
|||
pub fn col(&self) -> Option<u32> {
|
||||
match *self {
|
||||
DBOp::Insert { col, .. } => col,
|
||||
DBOp::InsertCompressed { col, .. } => col,
|
||||
DBOp::Delete { col, .. } => col,
|
||||
}
|
||||
}
|
||||
|
@ -122,18 +115,6 @@ impl DBTransaction {
|
|||
});
|
||||
}
|
||||
|
||||
/// Insert a key-value pair in the transaction. Any existing value will be overwritten upon write.
|
||||
/// Value will be RLP-compressed on flush
|
||||
pub fn put_compressed(&mut self, col: Option<u32>, key: &[u8], value: Bytes) {
|
||||
let mut ekey = ElasticArray32::new();
|
||||
ekey.append_slice(key);
|
||||
self.ops.push(DBOp::InsertCompressed {
|
||||
col: col,
|
||||
key: ekey,
|
||||
value: DBValue::from_vec(value),
|
||||
});
|
||||
}
|
||||
|
||||
/// Delete value by key.
|
||||
pub fn delete(&mut self, col: Option<u32>, key: &[u8]) {
|
||||
let mut ekey = ElasticArray32::new();
|
||||
|
|
Loading…
Reference in New Issue