pub type DBWithThreadMode<T> = DBCommon<T, DBWithThreadModeInner>;
Expand description
A type alias to RocksDB database.
See crate level documentation for a simple usage example.
See DBCommon
for full list of methods.
Aliased Type§
struct DBWithThreadMode<T> { /* private fields */ }
Implementations§
Source§impl<T: ThreadMode> DBWithThreadMode<T>
Methods of DBWithThreadMode
.
impl<T: ThreadMode> DBWithThreadMode<T>
Methods of DBWithThreadMode
.
Sourcepub fn open_default<P: AsRef<Path>>(path: P) -> Result<Self, Error>
pub fn open_default<P: AsRef<Path>>(path: P) -> Result<Self, Error>
Opens a database with default options.
Sourcepub fn open<P: AsRef<Path>>(opts: &Options, path: P) -> Result<Self, Error>
pub fn open<P: AsRef<Path>>(opts: &Options, path: P) -> Result<Self, Error>
Opens the database with the specified options.
Sourcepub fn open_for_read_only<P: AsRef<Path>>(
opts: &Options,
path: P,
error_if_log_file_exist: bool,
) -> Result<Self, Error>
pub fn open_for_read_only<P: AsRef<Path>>( opts: &Options, path: P, error_if_log_file_exist: bool, ) -> Result<Self, Error>
Opens the database for read only with the specified options.
Sourcepub fn open_as_secondary<P: AsRef<Path>>(
opts: &Options,
primary_path: P,
secondary_path: P,
) -> Result<Self, Error>
pub fn open_as_secondary<P: AsRef<Path>>( opts: &Options, primary_path: P, secondary_path: P, ) -> Result<Self, Error>
Opens the database as a secondary.
Sourcepub fn open_with_ttl<P: AsRef<Path>>(
opts: &Options,
path: P,
ttl: Duration,
) -> Result<Self, Error>
pub fn open_with_ttl<P: AsRef<Path>>( opts: &Options, path: P, ttl: Duration, ) -> Result<Self, Error>
Opens the database with a Time to Live compaction filter.
This applies the given ttl
to all column families created without an explicit TTL.
See DB::open_cf_descriptors_with_ttl
for more control over individual column family TTLs.
Sourcepub fn open_cf_with_ttl<P, I, N>(
opts: &Options,
path: P,
cfs: I,
ttl: Duration,
) -> Result<Self, Error>
pub fn open_cf_with_ttl<P, I, N>( opts: &Options, path: P, cfs: I, ttl: Duration, ) -> Result<Self, Error>
Opens the database with a Time to Live compaction filter and column family names.
Column families opened using this function will be created with default Options
.
Sourcepub fn open_cf_descriptors_with_ttl<P, I>(
opts: &Options,
path: P,
cfs: I,
ttl: Duration,
) -> Result<Self, Error>
pub fn open_cf_descriptors_with_ttl<P, I>( opts: &Options, path: P, cfs: I, ttl: Duration, ) -> Result<Self, Error>
Opens a database with the given database with a Time to Live compaction filter and column family descriptors.
Applies the provided ttl
as the default TTL for all column families.
Column families will inherit this TTL by default, unless their descriptor explicitly
sets a different TTL using ColumnFamilyTtl::Duration
or opts out using ColumnFamilyTtl::Disabled
.
NOTE: The default
column family is opened with Options::default()
unless
explicitly configured within the cfs
iterator.
To customize the default
column family’s options, include a ColumnFamilyDescriptor
with the name “default” in the cfs
iterator.
If you want to open default
cf with different options, set them explicitly in cfs
.
Sourcepub fn open_cf<P, I, N>(opts: &Options, path: P, cfs: I) -> Result<Self, Error>
pub fn open_cf<P, I, N>(opts: &Options, path: P, cfs: I) -> Result<Self, Error>
Opens a database with the given database options and column family names.
Column families opened using this function will be created with default Options
.
Sourcepub fn open_cf_with_opts<P, I, N>(
opts: &Options,
path: P,
cfs: I,
) -> Result<Self, Error>
pub fn open_cf_with_opts<P, I, N>( opts: &Options, path: P, cfs: I, ) -> Result<Self, Error>
Opens a database with the given database options and column family names.
Column families opened using given Options
.
Sourcepub fn open_cf_for_read_only<P, I, N>(
opts: &Options,
path: P,
cfs: I,
error_if_log_file_exist: bool,
) -> Result<Self, Error>
pub fn open_cf_for_read_only<P, I, N>( opts: &Options, path: P, cfs: I, error_if_log_file_exist: bool, ) -> Result<Self, Error>
Opens a database for read only with the given database options and column family names.
NOTE: default
column family is opened with Options::default()
.
If you want to open default
cf with different options, set them explicitly in cfs
.
Sourcepub fn open_cf_with_opts_for_read_only<P, I, N>(
db_opts: &Options,
path: P,
cfs: I,
error_if_log_file_exist: bool,
) -> Result<Self, Error>
pub fn open_cf_with_opts_for_read_only<P, I, N>( db_opts: &Options, path: P, cfs: I, error_if_log_file_exist: bool, ) -> Result<Self, Error>
Opens a database for read only with the given database options and column family names.
NOTE: default
column family is opened with Options::default()
.
If you want to open default
cf with different options, set them explicitly in cfs
.
Sourcepub fn open_cf_descriptors_read_only<P, I>(
opts: &Options,
path: P,
cfs: I,
error_if_log_file_exist: bool,
) -> Result<Self, Error>
pub fn open_cf_descriptors_read_only<P, I>( opts: &Options, path: P, cfs: I, error_if_log_file_exist: bool, ) -> Result<Self, Error>
Opens a database for ready only with the given database options and
column family descriptors.
NOTE: default
column family is opened with Options::default()
.
If you want to open default
cf with different options, set them explicitly in cfs
.
Sourcepub fn open_cf_as_secondary<P, I, N>(
opts: &Options,
primary_path: P,
secondary_path: P,
cfs: I,
) -> Result<Self, Error>
pub fn open_cf_as_secondary<P, I, N>( opts: &Options, primary_path: P, secondary_path: P, cfs: I, ) -> Result<Self, Error>
Opens the database as a secondary with the given database options and column family names.
NOTE: default
column family is opened with Options::default()
.
If you want to open default
cf with different options, set them explicitly in cfs
.
Sourcepub fn open_cf_descriptors_as_secondary<P, I>(
opts: &Options,
path: P,
secondary_path: P,
cfs: I,
) -> Result<Self, Error>
pub fn open_cf_descriptors_as_secondary<P, I>( opts: &Options, path: P, secondary_path: P, cfs: I, ) -> Result<Self, Error>
Opens the database as a secondary with the given database options and
column family descriptors.
NOTE: default
column family is opened with Options::default()
.
If you want to open default
cf with different options, set them explicitly in cfs
.
Sourcepub fn open_cf_descriptors<P, I>(
opts: &Options,
path: P,
cfs: I,
) -> Result<Self, Error>
pub fn open_cf_descriptors<P, I>( opts: &Options, path: P, cfs: I, ) -> Result<Self, Error>
Opens a database with the given database options and column family descriptors.
NOTE: default
column family is opened with Options::default()
.
If you want to open default
cf with different options, set them explicitly in cfs
.
Sourcepub fn delete_range_cf_opt<K: AsRef<[u8]>>(
&self,
cf: &impl AsColumnFamilyRef,
from: K,
to: K,
writeopts: &WriteOptions,
) -> Result<(), Error>
pub fn delete_range_cf_opt<K: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, from: K, to: K, writeopts: &WriteOptions, ) -> Result<(), Error>
Removes the database entries in the range ["from", "to")
using given write options.
Sourcepub fn delete_range_cf<K: AsRef<[u8]>>(
&self,
cf: &impl AsColumnFamilyRef,
from: K,
to: K,
) -> Result<(), Error>
pub fn delete_range_cf<K: AsRef<[u8]>>( &self, cf: &impl AsColumnFamilyRef, from: K, to: K, ) -> Result<(), Error>
Removes the database entries in the range ["from", "to")
using default write options.