|
|
@ -23,7 +23,7 @@ use std::path::Path; |
|
|
|
use std::slice; |
|
|
|
use std::slice; |
|
|
|
use std::str::from_utf8; |
|
|
|
use std::str::from_utf8; |
|
|
|
|
|
|
|
|
|
|
|
use self::libc::{c_void, size_t}; |
|
|
|
use self::libc::size_t; |
|
|
|
|
|
|
|
|
|
|
|
use rocksdb_ffi::{self, DBCFHandle, error_message}; |
|
|
|
use rocksdb_ffi::{self, DBCFHandle, error_message}; |
|
|
|
use rocksdb_options::{Options, WriteOptions}; |
|
|
|
use rocksdb_options::{Options, WriteOptions}; |
|
|
@ -317,7 +317,7 @@ impl DB { |
|
|
|
// These handles will be populated by DB.
|
|
|
|
// These handles will be populated by DB.
|
|
|
|
let cfhandles: Vec<rocksdb_ffi::DBCFHandle> = |
|
|
|
let cfhandles: Vec<rocksdb_ffi::DBCFHandle> = |
|
|
|
cfs_v.iter() |
|
|
|
cfs_v.iter() |
|
|
|
.map(|_| rocksdb_ffi::DBCFHandle(0 as *mut c_void)) |
|
|
|
.map(|_| 0 as rocksdb_ffi::DBCFHandle) |
|
|
|
.collect(); |
|
|
|
.collect(); |
|
|
|
|
|
|
|
|
|
|
|
// TODO(tyler) allow options to be passed in.
|
|
|
|
// TODO(tyler) allow options to be passed in.
|
|
|
@ -338,7 +338,7 @@ impl DB { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for handle in cfhandles.iter() { |
|
|
|
for handle in cfhandles.iter() { |
|
|
|
if handle.0.is_null() { |
|
|
|
if handle.is_null() { |
|
|
|
return Err("Received null column family handle from DB." |
|
|
|
return Err("Received null column family handle from DB." |
|
|
|
.to_string()); |
|
|
|
.to_string()); |
|
|
|
} |
|
|
|
} |
|
|
@ -352,7 +352,7 @@ impl DB { |
|
|
|
if !err.is_null() { |
|
|
|
if !err.is_null() { |
|
|
|
return Err(error_message(err)); |
|
|
|
return Err(error_message(err)); |
|
|
|
} |
|
|
|
} |
|
|
|
if db.0.is_null() { |
|
|
|
if db.is_null() { |
|
|
|
return Err("Could not initialize database.".to_string()); |
|
|
|
return Err("Could not initialize database.".to_string()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -422,7 +422,7 @@ impl DB { |
|
|
|
key: &[u8], |
|
|
|
key: &[u8], |
|
|
|
readopts: &ReadOptions) |
|
|
|
readopts: &ReadOptions) |
|
|
|
-> Result<Option<DBVector>, String> { |
|
|
|
-> Result<Option<DBVector>, String> { |
|
|
|
if readopts.inner.0.is_null() { |
|
|
|
if readopts.inner.is_null() { |
|
|
|
return Err("Unable to create rocksdb read options. This is a \ |
|
|
|
return Err("Unable to create rocksdb read options. This is a \ |
|
|
|
fairly trivial call, and its failure may be \ |
|
|
|
fairly trivial call, and its failure may be \ |
|
|
|
indicative of a mis-compiled or mis-loaded rocksdb \ |
|
|
|
indicative of a mis-compiled or mis-loaded rocksdb \ |
|
|
@ -461,7 +461,7 @@ impl DB { |
|
|
|
key: &[u8], |
|
|
|
key: &[u8], |
|
|
|
readopts: &ReadOptions) |
|
|
|
readopts: &ReadOptions) |
|
|
|
-> Result<Option<DBVector>, String> { |
|
|
|
-> Result<Option<DBVector>, String> { |
|
|
|
if readopts.inner.0.is_null() { |
|
|
|
if readopts.inner.is_null() { |
|
|
|
return Err("Unable to create rocksdb read options. This is a \ |
|
|
|
return Err("Unable to create rocksdb read options. This is a \ |
|
|
|
fairly trivial call, and its failure may be \ |
|
|
|
fairly trivial call, and its failure may be \ |
|
|
|
indicative of a mis-compiled or mis-loaded rocksdb \ |
|
|
|
indicative of a mis-compiled or mis-loaded rocksdb \ |
|
|
|