pub fn new<P: AsRef<Path>>(location: P, create_if_missing: bool) -> Result<DB, Error> {
        // number of bytes to take into consideration when looking for a similar prefix
        // would be helpful when querying the DB using iterators.
        let prefix_extractor = SliceTransform::create_fixed_prefix(1);
        let mut options = Options::default();
        options.create_if_missing(create_if_missing);
        options.set_prefix_extractor(prefix_extractor);
        // cf_list gets a list of all column families (addresses) from the location where the DB
        // is stored and when opening it, it adds the list as an argument to the DB. this is done
        // in case the DB existed, otherwise, an empty list will be added and the call will
        // be similar to a fresh start
        let cf_list = match rocks_db::list_cf(&options, &location) {
            Ok(list) => list,
            Err(_) => Vec::new(),
        };
        // converts the Strings to slices (str)
        let cf_list_burrowed = cf_list.iter().map(|i| i.as_str()).collect::<Vec<&str>>();
        let database = rocks_db::open_cf(&options, &location, &cf_list_burrowed[..])?;
        let location = location.as_ref().to_path_buf();
        let db_par = DB { location, database, options };
        Ok(db_par)
    }
/// Constructs a new `DB`. with a db file accordingly.
///
/// You need to pass a path for the location of the db file
/// and as a default, it adds options with a flag which creates the file if missing
///
/// This Supports all the CRUD operations
/// # Examples
/// ```
/// # extern crate tempfile;
/// # extern crate enigma_core_app;
/// # use enigma_core_app::db::dal::DB;
///
/// # let tempdir = tempfile::tempdir().unwrap();
/// # let path = tempdir.path();
/// let mut db = DB::new(path, true).unwrap();
/// ```
Constructs a new `DB`. with a db file accordingly.
You need to pass a path for the location of the db file
and as a default, it adds options with a flag which creates the file if missing

This Supports all the CRUD operations
Constructs a new ` DB ` . with a db file accordingly . You need to pass a path for the location of the db file and as a default it adds options with a flag which creates the file if missing This Supports all the CRUD operations
pub fn new<P: AsRef<Path>>(location: P, create_if_missing: bool) -> Result<DB, Error> {
        // number of bytes to take into consideration when looking for a similar prefix
        // would be helpful when querying the DB using iterators.
        let prefix_extractor = SliceTransform::create_fixed_prefix(1);
        let mut options = Options::default();
        options.create_if_missing(create_if_missing);
        options.set_prefix_extractor(prefix_extractor);
        // cf_list gets a list of all column families (addresses) from the location where the DB
        // is stored and when opening it, it adds the list as an argument to the DB. this is done
        // in case the DB existed, otherwise, an empty list will be added and the call will
        // be similar to a fresh start
        let cf_list = match rocks_db::list_cf(&options, &location) {
            Ok(list) => list,
            Err(_) => Vec::new(),
        };
        // converts the Strings to slices (str)
        let cf_list_burrowed = cf_list.iter().map(|i| i.as_str()).collect::<Vec<&str>>();
        let database = rocks_db::open_cf(&options, &location, &cf_list_burrowed[..])?;
        let location = location.as_ref().to_path_buf();
        let db_par = DB { location, database, options };
        Ok(db_par)
    }
pub fn new < P : AsRef < Path > > ( location : P , create_if_missing : bool ) -> Result < DB , Error > { // number of bytes to take into consideration when looking for a similar prefix // would be helpful when querying the DB using iterators. let prefix_extractor = SliceTransform :: create_fixed_prefix ( 1 ) ; let mut options = Options :: default ( ) ; options . create_if_missing ( create_if_missing ) ; options . set_prefix_extractor ( prefix_extractor ) ; // cf_list gets a list of all column families (addresses) from the location where the DB // is stored and when opening it, it adds the list as an argument to the DB. this is done // in case the DB existed, otherwise, an empty list will be added and the call will // be similar to a fresh start let cf_list = match rocks_db :: list_cf ( & options , & location ) { Ok ( list ) => list , Err ( _ ) => Vec :: new ( ) , } ; // converts the Strings to slices (str) let cf_list_burrowed = cf_list . iter ( ) . map ( | i | i . as_str ( ) ) . collect :: < Vec < & str > > ( ) ; let database = rocks_db :: open_cf ( & options , & location , & cf_list_burrowed [ .. ] ) ? ; let location = location . as_ref ( ) . to_path_buf ( ) ; let db_par = DB { location , database , options } ; Ok ( db_par ) }
Constructs a new `DB`.
Constructs a new ` DB ` .
location
P
create_if_missing
bool
location
P
create_if_missing
bool
examples
None
extern crate tempfile;
None
extern crate enigma_core_app;
None
use enigma_core_app::db::dal::db;
None
let tempdir = tempfile::tempdir().unwrap();
None
let path = tempdir.path();
let mut db = DB::new(path, true).unwrap();
```
let mut db = DB :: new ( path true ) . unwrap () ; ` ` `