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