|
|
|
@ -22,7 +22,7 @@ pub fn test_column_family() { |
|
|
|
|
{ |
|
|
|
|
let mut opts = Options::default(); |
|
|
|
|
opts.create_if_missing(true); |
|
|
|
|
opts.add_merge_operator("test operator", test_provided_merge); |
|
|
|
|
opts.set_merge_operator("test operator", test_provided_merge); |
|
|
|
|
let mut db = DB::open(&opts, path).unwrap(); |
|
|
|
|
let opts = Options::default(); |
|
|
|
|
match db.create_cf("cf1", &opts) { |
|
|
|
@ -36,7 +36,7 @@ pub fn test_column_family() { |
|
|
|
|
// should fail to open db without specifying same column families
|
|
|
|
|
{ |
|
|
|
|
let mut opts = Options::default(); |
|
|
|
|
opts.add_merge_operator("test operator", test_provided_merge); |
|
|
|
|
opts.set_merge_operator("test operator", test_provided_merge); |
|
|
|
|
match DB::open(&opts, path) { |
|
|
|
|
Ok(_) => { |
|
|
|
|
panic!("should not have opened DB successfully without \ |
|
|
|
@ -53,7 +53,7 @@ pub fn test_column_family() { |
|
|
|
|
// should properly open db when specyfing all column families
|
|
|
|
|
{ |
|
|
|
|
let mut opts = Options::default(); |
|
|
|
|
opts.add_merge_operator("test operator", test_provided_merge); |
|
|
|
|
opts.set_merge_operator("test operator", test_provided_merge); |
|
|
|
|
match DB::open_cf(&opts, path, &["cf1"]) { |
|
|
|
|
Ok(_) => println!("successfully opened db with column family"), |
|
|
|
|
Err(e) => panic!("failed to open db with column family: {}", e), |
|
|
|
@ -84,7 +84,7 @@ fn test_merge_operator() { |
|
|
|
|
// TODO should be able to write, read, merge, batch, and iterate over a cf
|
|
|
|
|
{ |
|
|
|
|
let mut opts = Options::default(); |
|
|
|
|
opts.add_merge_operator("test operator", test_provided_merge); |
|
|
|
|
opts.set_merge_operator("test operator", test_provided_merge); |
|
|
|
|
let db = match DB::open_cf(&opts, path, &["cf1"]) { |
|
|
|
|
Ok(db) => { |
|
|
|
|
println!("successfully opened db with column family"); |
|
|
|
|