|
|
@ -57,12 +57,11 @@ impl RocksDB { |
|
|
|
|
|
|
|
|
|
|
|
let err = 0 as *mut i8; |
|
|
|
let err = 0 as *mut i8; |
|
|
|
let db = rocksdb_ffi::rocksdb_open(opts.inner, cpath_ptr, err); |
|
|
|
let db = rocksdb_ffi::rocksdb_open(opts.inner, cpath_ptr, err); |
|
|
|
let rocksdb_ffi::RocksDBInstance(db_ptr) = db; |
|
|
|
|
|
|
|
if !err.is_null() { |
|
|
|
if !err.is_null() { |
|
|
|
let cs = from_c_str(err as *const i8); |
|
|
|
let cs = from_c_str(err as *const i8); |
|
|
|
return Err(cs); |
|
|
|
return Err(cs); |
|
|
|
} |
|
|
|
} |
|
|
|
if db_ptr.is_null() { |
|
|
|
if db.0.is_null() { |
|
|
|
return Err("Could not initialize database."); |
|
|
|
return Err("Could not initialize database."); |
|
|
|
} |
|
|
|
} |
|
|
|
Ok(RocksDB{inner: db}) |
|
|
|
Ok(RocksDB{inner: db}) |
|
|
@ -134,8 +133,7 @@ impl RocksDB { |
|
|
|
RocksDBResult<'a, RocksDBVector, &str> { |
|
|
|
RocksDBResult<'a, RocksDBVector, &str> { |
|
|
|
unsafe { |
|
|
|
unsafe { |
|
|
|
let readopts = rocksdb_ffi::rocksdb_readoptions_create(); |
|
|
|
let readopts = rocksdb_ffi::rocksdb_readoptions_create(); |
|
|
|
let rocksdb_ffi::RocksDBReadOptions(read_opts_ptr) = readopts; |
|
|
|
if readopts.0.is_null() { |
|
|
|
if read_opts_ptr.is_null() { |
|
|
|
|
|
|
|
return RocksDBResult::Error("Unable to create rocksdb read \ |
|
|
|
return RocksDBResult::Error("Unable to create rocksdb read \ |
|
|
|
options. This is a fairly trivial call, and its failure \ |
|
|
|
options. This is a fairly trivial call, and its failure \ |
|
|
|
may be indicative of a mis-compiled or mis-loaded rocksdb \ |
|
|
|
may be indicative of a mis-compiled or mis-loaded rocksdb \ |
|
|
|