From 83ff5bc2000f0bee77cfbeb931f52bdd400c0902 Mon Sep 17 00:00:00 2001 From: fdeantoni Date: Tue, 23 Mar 2021 08:54:21 +0800 Subject: [PATCH] Add DB::open_cf_descriptors_with_ttl method Added comment clarifying default cf options will be used for `open_cf_with_ttl` and added method `open_cf_descriptors_with_ttl` to allow opening up of database with TTL and ColumnFamilyDescriptors. --- src/db.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/db.rs b/src/db.rs index 23583dfe5..5b69c572a 100644 --- a/src/db.rs +++ b/src/db.rs @@ -111,6 +111,8 @@ impl DB { } /// 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`. pub fn open_cf_with_ttl( opts: &Options, path: P, @@ -126,6 +128,21 @@ impl DB { .into_iter() .map(|name| ColumnFamilyDescriptor::new(name.as_ref(), Options::default())); + DB::open_cf_descriptors_with_ttl(opts, path, cfs, ttl) + } + + /// Opens a database with the given database with a Time to Live compaction filter and + /// column family descriptors. + pub fn open_cf_descriptors_with_ttl( + opts: &Options, + path: P, + cfs: I, + ttl: Duration, + ) -> Result + where + P: AsRef, + I: IntoIterator, + { DB::open_cf_descriptors_internal(opts, path, cfs, &AccessType::WithTTL { ttl }) }