|
|
|
@ -42,12 +42,9 @@ extern crate rocksdb; |
|
|
|
|
use rocksdb::{RocksDBOptions, RocksDB, MergeOperands}; |
|
|
|
|
|
|
|
|
|
fn concat_merge(new_key: &[u8], existing_val: Option<&[u8]>, |
|
|
|
|
mut operands: &mut MergeOperands) -> Vec<u8> { |
|
|
|
|
operands: &mut MergeOperands) -> Vec<u8> { |
|
|
|
|
let mut result: Vec<u8> = Vec::with_capacity(operands.size_hint().0); |
|
|
|
|
match existing_val { |
|
|
|
|
Some(v) => result.push_all(v), |
|
|
|
|
None => (), |
|
|
|
|
} |
|
|
|
|
existing_val.map(|v| { result.push_all(v) }); |
|
|
|
|
for op in operands { |
|
|
|
|
result.push_all(op); |
|
|
|
|
} |
|
|
|
|