|
|
@ -107,23 +107,23 @@ impl Drop for EnvWrapper { |
|
|
|
|
|
|
|
|
|
|
|
impl Env { |
|
|
|
impl Env { |
|
|
|
/// Returns default env
|
|
|
|
/// Returns default env
|
|
|
|
pub fn default() -> Result<Env, Error> { |
|
|
|
pub fn default() -> Result<Self, Error> { |
|
|
|
let env = unsafe { ffi::rocksdb_create_default_env() }; |
|
|
|
let env = unsafe { ffi::rocksdb_create_default_env() }; |
|
|
|
if env.is_null() { |
|
|
|
if env.is_null() { |
|
|
|
Err(Error::new("Could not create mem env".to_owned())) |
|
|
|
Err(Error::new("Could not create mem env".to_owned())) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Ok(Env(Arc::new(EnvWrapper { inner: env }))) |
|
|
|
Ok(Self(Arc::new(EnvWrapper { inner: env }))) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Returns a new environment that stores its data in memory and delegates
|
|
|
|
/// Returns a new environment that stores its data in memory and delegates
|
|
|
|
/// all non-file-storage tasks to base_env.
|
|
|
|
/// all non-file-storage tasks to base_env.
|
|
|
|
pub fn mem_env() -> Result<Env, Error> { |
|
|
|
pub fn mem_env() -> Result<Self, Error> { |
|
|
|
let env = unsafe { ffi::rocksdb_create_mem_env() }; |
|
|
|
let env = unsafe { ffi::rocksdb_create_mem_env() }; |
|
|
|
if env.is_null() { |
|
|
|
if env.is_null() { |
|
|
|
Err(Error::new("Could not create mem env".to_owned())) |
|
|
|
Err(Error::new("Could not create mem env".to_owned())) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Ok(Env(Arc::new(EnvWrapper { inner: env }))) |
|
|
|
Ok(Self(Arc::new(EnvWrapper { inner: env }))) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -700,12 +700,12 @@ impl BlockBasedOptions { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Default for BlockBasedOptions { |
|
|
|
impl Default for BlockBasedOptions { |
|
|
|
fn default() -> BlockBasedOptions { |
|
|
|
fn default() -> Self { |
|
|
|
let block_opts = unsafe { ffi::rocksdb_block_based_options_create() }; |
|
|
|
let block_opts = unsafe { ffi::rocksdb_block_based_options_create() }; |
|
|
|
if block_opts.is_null() { |
|
|
|
if block_opts.is_null() { |
|
|
|
panic!("Could not create RocksDB block based options"); |
|
|
|
panic!("Could not create RocksDB block based options"); |
|
|
|
} |
|
|
|
} |
|
|
|
BlockBasedOptions { |
|
|
|
Self { |
|
|
|
inner: block_opts, |
|
|
|
inner: block_opts, |
|
|
|
outlive: BlockBasedOptionsMustOutliveDB::default(), |
|
|
|
outlive: BlockBasedOptionsMustOutliveDB::default(), |
|
|
|
} |
|
|
|
} |
|
|
@ -762,12 +762,12 @@ impl CuckooTableOptions { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Default for CuckooTableOptions { |
|
|
|
impl Default for CuckooTableOptions { |
|
|
|
fn default() -> CuckooTableOptions { |
|
|
|
fn default() -> Self { |
|
|
|
let opts = unsafe { ffi::rocksdb_cuckoo_options_create() }; |
|
|
|
let opts = unsafe { ffi::rocksdb_cuckoo_options_create() }; |
|
|
|
if opts.is_null() { |
|
|
|
if opts.is_null() { |
|
|
|
panic!("Could not create RocksDB cuckoo options"); |
|
|
|
panic!("Could not create RocksDB cuckoo options"); |
|
|
|
} |
|
|
|
} |
|
|
|
CuckooTableOptions { inner: opts } |
|
|
|
Self { inner: opts } |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2865,13 +2865,13 @@ impl Options { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Default for Options { |
|
|
|
impl Default for Options { |
|
|
|
fn default() -> Options { |
|
|
|
fn default() -> Self { |
|
|
|
unsafe { |
|
|
|
unsafe { |
|
|
|
let opts = ffi::rocksdb_options_create(); |
|
|
|
let opts = ffi::rocksdb_options_create(); |
|
|
|
if opts.is_null() { |
|
|
|
if opts.is_null() { |
|
|
|
panic!("Could not create RocksDB options"); |
|
|
|
panic!("Could not create RocksDB options"); |
|
|
|
} |
|
|
|
} |
|
|
|
Options { |
|
|
|
Self { |
|
|
|
inner: opts, |
|
|
|
inner: opts, |
|
|
|
outlive: OptionsMustOutliveDB::default(), |
|
|
|
outlive: OptionsMustOutliveDB::default(), |
|
|
|
} |
|
|
|
} |
|
|
@ -2904,12 +2904,12 @@ impl FlushOptions { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Default for FlushOptions { |
|
|
|
impl Default for FlushOptions { |
|
|
|
fn default() -> FlushOptions { |
|
|
|
fn default() -> Self { |
|
|
|
let flush_opts = unsafe { ffi::rocksdb_flushoptions_create() }; |
|
|
|
let flush_opts = unsafe { ffi::rocksdb_flushoptions_create() }; |
|
|
|
if flush_opts.is_null() { |
|
|
|
if flush_opts.is_null() { |
|
|
|
panic!("Could not create RocksDB flush options"); |
|
|
|
panic!("Could not create RocksDB flush options"); |
|
|
|
} |
|
|
|
} |
|
|
|
FlushOptions { inner: flush_opts } |
|
|
|
Self { inner: flush_opts } |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2992,12 +2992,12 @@ impl WriteOptions { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Default for WriteOptions { |
|
|
|
impl Default for WriteOptions { |
|
|
|
fn default() -> WriteOptions { |
|
|
|
fn default() -> Self { |
|
|
|
let write_opts = unsafe { ffi::rocksdb_writeoptions_create() }; |
|
|
|
let write_opts = unsafe { ffi::rocksdb_writeoptions_create() }; |
|
|
|
if write_opts.is_null() { |
|
|
|
if write_opts.is_null() { |
|
|
|
panic!("Could not create RocksDB write options"); |
|
|
|
panic!("Could not create RocksDB write options"); |
|
|
|
} |
|
|
|
} |
|
|
|
WriteOptions { inner: write_opts } |
|
|
|
Self { inner: write_opts } |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -3191,9 +3191,9 @@ impl ReadOptions { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Default for ReadOptions { |
|
|
|
impl Default for ReadOptions { |
|
|
|
fn default() -> ReadOptions { |
|
|
|
fn default() -> Self { |
|
|
|
unsafe { |
|
|
|
unsafe { |
|
|
|
ReadOptions { |
|
|
|
Self { |
|
|
|
inner: ffi::rocksdb_readoptions_create(), |
|
|
|
inner: ffi::rocksdb_readoptions_create(), |
|
|
|
iterate_upper_bound: None, |
|
|
|
iterate_upper_bound: None, |
|
|
|
iterate_lower_bound: None, |
|
|
|
iterate_lower_bound: None, |
|
|
@ -3255,9 +3255,9 @@ impl IngestExternalFileOptions { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Default for IngestExternalFileOptions { |
|
|
|
impl Default for IngestExternalFileOptions { |
|
|
|
fn default() -> IngestExternalFileOptions { |
|
|
|
fn default() -> Self { |
|
|
|
unsafe { |
|
|
|
unsafe { |
|
|
|
IngestExternalFileOptions { |
|
|
|
Self { |
|
|
|
inner: ffi::rocksdb_ingestexternalfileoptions_create(), |
|
|
|
inner: ffi::rocksdb_ingestexternalfileoptions_create(), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -3362,12 +3362,12 @@ pub struct FifoCompactOptions { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Default for FifoCompactOptions { |
|
|
|
impl Default for FifoCompactOptions { |
|
|
|
fn default() -> FifoCompactOptions { |
|
|
|
fn default() -> Self { |
|
|
|
let opts = unsafe { ffi::rocksdb_fifo_compaction_options_create() }; |
|
|
|
let opts = unsafe { ffi::rocksdb_fifo_compaction_options_create() }; |
|
|
|
if opts.is_null() { |
|
|
|
if opts.is_null() { |
|
|
|
panic!("Could not create RocksDB Fifo Compaction Options"); |
|
|
|
panic!("Could not create RocksDB Fifo Compaction Options"); |
|
|
|
} |
|
|
|
} |
|
|
|
FifoCompactOptions { inner: opts } |
|
|
|
Self { inner: opts } |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -3404,12 +3404,12 @@ pub struct UniversalCompactOptions { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Default for UniversalCompactOptions { |
|
|
|
impl Default for UniversalCompactOptions { |
|
|
|
fn default() -> UniversalCompactOptions { |
|
|
|
fn default() -> Self { |
|
|
|
let opts = unsafe { ffi::rocksdb_universal_compaction_options_create() }; |
|
|
|
let opts = unsafe { ffi::rocksdb_universal_compaction_options_create() }; |
|
|
|
if opts.is_null() { |
|
|
|
if opts.is_null() { |
|
|
|
panic!("Could not create RocksDB Universal Compaction Options"); |
|
|
|
panic!("Could not create RocksDB Universal Compaction Options"); |
|
|
|
} |
|
|
|
} |
|
|
|
UniversalCompactOptions { inner: opts } |
|
|
|
Self { inner: opts } |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -3526,12 +3526,12 @@ pub struct CompactOptions { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl Default for CompactOptions { |
|
|
|
impl Default for CompactOptions { |
|
|
|
fn default() -> CompactOptions { |
|
|
|
fn default() -> Self { |
|
|
|
let opts = unsafe { ffi::rocksdb_compactoptions_create() }; |
|
|
|
let opts = unsafe { ffi::rocksdb_compactoptions_create() }; |
|
|
|
if opts.is_null() { |
|
|
|
if opts.is_null() { |
|
|
|
panic!("Could not create RocksDB Compact Options"); |
|
|
|
panic!("Could not create RocksDB Compact Options"); |
|
|
|
} |
|
|
|
} |
|
|
|
CompactOptions { inner: opts } |
|
|
|
Self { inner: opts } |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|