Add method for opening DB with ro access and cf descriptors (#569)

master
nikurt 3 years ago committed by GitHub
parent db407cd050
commit 8b3190d254
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      src/db.rs

@ -333,6 +333,32 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
)
}
/// Opens a database for read only with the given database options and column family names.
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>
where
P: AsRef<Path>,
I: IntoIterator<Item = (N, Options)>,
N: AsRef<str>,
{
let cfs = cfs
.into_iter()
.map(|(name, cf_opts)| ColumnFamilyDescriptor::new(name.as_ref(), cf_opts));
Self::open_cf_descriptors_internal(
db_opts,
path,
cfs,
&AccessType::ReadOnly {
error_if_log_file_exist,
},
)
}
/// Opens the database as a secondary with the given database options and column family names.
pub fn open_cf_as_secondary<P, I, N>(
opts: &Options,

Loading…
Cancel
Save