Skip to content

Commit

Permalink
docs: document that default cf doesn't inherit db open options
Browse files Browse the repository at this point in the history
  • Loading branch information
0xdeafbeef authored and zaidoon1 committed May 8, 2024
1 parent 6face7b commit daaaf85
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## [Unreleased]
* Document that `default` column family doesn't inherit open options of db (
0xdeafbeef)

## 0.22.0 (2024-02-13)

Expand Down
14 changes: 14 additions & 0 deletions src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,8 @@ impl<T: ThreadMode> DBWithThreadMode<T> {

/// Opens a database with the given database with a Time to Live compaction filter 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`.
pub fn open_cf_descriptors_with_ttl<P, I>(
opts: &Options,
path: P,
Expand Down Expand Up @@ -454,6 +456,8 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
}

/// 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`.
pub fn open_cf_for_read_only<P, I, N>(
opts: &Options,
path: P,
Expand All @@ -480,6 +484,8 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
}

/// 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`.
pub fn open_cf_with_opts_for_read_only<P, I, N>(
db_opts: &Options,
path: P,
Expand Down Expand Up @@ -507,6 +513,8 @@ impl<T: ThreadMode> DBWithThreadMode<T> {

/// 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`.
pub fn open_cf_descriptors_read_only<P, I>(
opts: &Options,
path: P,
Expand All @@ -528,6 +536,8 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
}

/// 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`.
pub fn open_cf_as_secondary<P, I, N>(
opts: &Options,
primary_path: P,
Expand Down Expand Up @@ -555,6 +565,8 @@ impl<T: ThreadMode> DBWithThreadMode<T> {

/// 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`.
pub fn open_cf_descriptors_as_secondary<P, I>(
opts: &Options,
path: P,
Expand All @@ -576,6 +588,8 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
}

/// 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`.
pub fn open_cf_descriptors<P, I>(opts: &Options, path: P, cfs: I) -> Result<Self, Error>
where
P: AsRef<Path>,
Expand Down
3 changes: 3 additions & 0 deletions src/transactions/optimistic_transaction_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ impl<T: ThreadMode> OptimisticTransactionDB<T> {
/// Opens a database with the given database options and column family names.
///
/// Column families opened using this function will be created with default `Options`.
/// *NOTE*: `default` column family will be opened with the `Options::default()`.
/// If you want to open `default` column family with custom options, use `open_cf_descriptors` and
/// provide a `ColumnFamilyDescriptor` with the desired options.
pub fn open_cf<P, I, N>(opts: &Options, path: P, cfs: I) -> Result<Self, Error>
where
P: AsRef<Path>,
Expand Down

0 comments on commit daaaf85

Please sign in to comment.