From a4a3e1d7c412af14eb98ae24cce410523bedfbf8 Mon Sep 17 00:00:00 2001 From: Gary Tierney Date: Sun, 3 Sep 2017 18:34:14 +0100 Subject: [PATCH] Add documentation for ColumnFamilyDescriptor --- src/lib.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index d42b1a8..1e221c0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,6 +30,21 @@ //! db.delete(b"my key").unwrap(); //! ``` //! +//! Opening a database and a single column family with custom options: +//! +//! ``` +//! use rocksdb::{DB, ColumnFamilyDescriptor, Options}; +//! let mut cf_opts = Options::default(); +//! cf_opts.set_max_write_buffer_number(16); +//! let cf = ColumnFamilyDescriptor::new("cf1", cf_opts); +//! +//! let mut db_opts = Options::default(); +//! db_opts.create_missing_column_families(true); +//! db_opts.create_if_missing(true); +//! +//! let db = DB::open_cf_descriptors(&db_opts, "path/for/rocksdb/storage_with_cfs", vec![cf]).unwrap(); +//! ``` +//! extern crate libc; extern crate librocksdb_sys as ffi; @@ -63,6 +78,9 @@ pub struct DB { path: PathBuf, } +/// A descriptor for a RocksDB column family. +/// +/// A description of the column family, containing the name and `Options`. pub struct ColumnFamilyDescriptor { name: String, options: Options,