Skip to content

Commit

Permalink
Add DB::open_cf_descriptors_with_ttl method
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fdeantoni committed Mar 23, 2021
1 parent 70eec41 commit 83ff5bc
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/db.rs
Expand Up @@ -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<P, I, N>(
opts: &Options,
path: P,
Expand All @@ -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<P, I>(
opts: &Options,
path: P,
cfs: I,
ttl: Duration,
) -> Result<DB, Error>
where
P: AsRef<Path>,
I: IntoIterator<Item = ColumnFamilyDescriptor>,
{
DB::open_cf_descriptors_internal(opts, path, cfs, &AccessType::WithTTL { ttl })
}

Expand Down

0 comments on commit 83ff5bc

Please sign in to comment.