pub fn new<P: AsRef<Path> + Clone>(db_root_path: P) -> Self {
        let cf_opts_map: ColumnFamilyOptionsMap = [
            (
                /* LedgerInfo CF = */ DEFAULT_CF_NAME,
                ColumnFamilyOptions::default(),
            ),
            (EVENT_ACCUMULATOR_CF_NAME, ColumnFamilyOptions::default()),
            (EVENT_BY_ACCESS_PATH_CF_NAME, ColumnFamilyOptions::default()),
            (EVENT_CF_NAME, ColumnFamilyOptions::default()),
            (
                JELLYFISH_MERKLE_NODE_CF_NAME,
                ColumnFamilyOptions::default(),
            ),
            (LEDGER_COUNTERS_CF_NAME, ColumnFamilyOptions::default()),
            (STALE_NODE_INDEX_CF_NAME, ColumnFamilyOptions::default()),
            (SIGNED_TRANSACTION_CF_NAME, ColumnFamilyOptions::default()),
            (
                TRANSACTION_ACCUMULATOR_CF_NAME,
                ColumnFamilyOptions::default(),
            ),
            (TRANSACTION_INFO_CF_NAME, ColumnFamilyOptions::default()),
            (VALIDATOR_CF_NAME, ColumnFamilyOptions::default()),
        ]
        .iter()
        .cloned()
        .collect();

        let path = db_root_path.as_ref().join("libradb");
        let instant = Instant::now();
        let db = Arc::new(
            DB::open(path.clone(), cf_opts_map)
                .unwrap_or_else(|e| panic!("LibraDB open failed: {:?}", e)),
        );

        info!(
            "Opened LibraDB at {:?} in {} ms",
            path,
            instant.elapsed().as_millis()
        );

        LibraDB {
            db: Arc::clone(&db),
            event_store: EventStore::new(Arc::clone(&db)),
            ledger_store: LedgerStore::new(Arc::clone(&db)),
            state_store: StateStore::new(Arc::clone(&db)),
            transaction_store: TransactionStore::new(Arc::clone(&db)),
            system_store: SystemStore::new(Arc::clone(&db)),
            pruner: Pruner::new(Arc::clone(&db), Self::NUM_HISTORICAL_VERSIONS_TO_KEEP),
        }
    }
/// This creates an empty LibraDB instance on disk or opens one if it already exists.
This creates an empty LibraDB instance on disk or opens one if it already exists.
This creates an empty LibraDB instance on disk or opens one if it already exists .
pub fn new<P: AsRef<Path> + Clone>(db_root_path: P) -> Self {
        let cf_opts_map: ColumnFamilyOptionsMap = [
            (
                /* LedgerInfo CF = */ DEFAULT_CF_NAME,
                ColumnFamilyOptions::default(),
            ),
            (EVENT_ACCUMULATOR_CF_NAME, ColumnFamilyOptions::default()),
            (EVENT_BY_ACCESS_PATH_CF_NAME, ColumnFamilyOptions::default()),
            (EVENT_CF_NAME, ColumnFamilyOptions::default()),
            (
                JELLYFISH_MERKLE_NODE_CF_NAME,
                ColumnFamilyOptions::default(),
            ),
            (LEDGER_COUNTERS_CF_NAME, ColumnFamilyOptions::default()),
            (STALE_NODE_INDEX_CF_NAME, ColumnFamilyOptions::default()),
            (SIGNED_TRANSACTION_CF_NAME, ColumnFamilyOptions::default()),
            (
                TRANSACTION_ACCUMULATOR_CF_NAME,
                ColumnFamilyOptions::default(),
            ),
            (TRANSACTION_INFO_CF_NAME, ColumnFamilyOptions::default()),
            (VALIDATOR_CF_NAME, ColumnFamilyOptions::default()),
        ]
        .iter()
        .cloned()
        .collect();
        let path = db_root_path.as_ref().join("libradb");
        let instant = Instant::now();
        let db = Arc::new(
            DB::open(path.clone(), cf_opts_map)
                .unwrap_or_else(|e| panic!("LibraDB open failed: {:?}", e)),
        );
        info!(
            "Opened LibraDB at {:?} in {} ms",
            path,
            instant.elapsed().as_millis()
        );
        LibraDB {
            db: Arc::clone(&db),
            event_store: EventStore::new(Arc::clone(&db)),
            ledger_store: LedgerStore::new(Arc::clone(&db)),
            state_store: StateStore::new(Arc::clone(&db)),
            transaction_store: TransactionStore::new(Arc::clone(&db)),
            system_store: SystemStore::new(Arc::clone(&db)),
            pruner: Pruner::new(Arc::clone(&db), Self::NUM_HISTORICAL_VERSIONS_TO_KEEP),
        }
    }
pub fn new < P : AsRef < Path > + Clone > ( db_root_path : P ) -> Self { let cf_opts_map : ColumnFamilyOptionsMap = [ ( /* LedgerInfo CF = */ DEFAULT_CF_NAME , ColumnFamilyOptions :: default ( ) , ) , ( EVENT_ACCUMULATOR_CF_NAME , ColumnFamilyOptions :: default ( ) ) , ( EVENT_BY_ACCESS_PATH_CF_NAME , ColumnFamilyOptions :: default ( ) ) , ( EVENT_CF_NAME , ColumnFamilyOptions :: default ( ) ) , ( JELLYFISH_MERKLE_NODE_CF_NAME , ColumnFamilyOptions :: default ( ) , ) , ( LEDGER_COUNTERS_CF_NAME , ColumnFamilyOptions :: default ( ) ) , ( STALE_NODE_INDEX_CF_NAME , ColumnFamilyOptions :: default ( ) ) , ( SIGNED_TRANSACTION_CF_NAME , ColumnFamilyOptions :: default ( ) ) , ( TRANSACTION_ACCUMULATOR_CF_NAME , ColumnFamilyOptions :: default ( ) , ) , ( TRANSACTION_INFO_CF_NAME , ColumnFamilyOptions :: default ( ) ) , ( VALIDATOR_CF_NAME , ColumnFamilyOptions :: default ( ) ) , ] . iter ( ) . cloned ( ) . collect ( ) ; let path = db_root_path . as_ref ( ) . join ( " " ) ; let instant = Instant :: now ( ) ; let db = Arc :: new ( DB :: open ( path . clone ( ) , cf_opts_map ) . unwrap_or_else ( | e | panic ! ( " " e ) ) , ) ; info ! ( " " path instant elapsed ( ) as_millis ( ) ) ; LibraDB { db : Arc :: clone ( & db ) , event_store : EventStore :: new ( Arc :: clone ( & db ) ) , ledger_store : LedgerStore :: new ( Arc :: clone ( & db ) ) , state_store : StateStore :: new ( Arc :: clone ( & db ) ) , transaction_store : TransactionStore :: new ( Arc :: clone ( & db ) ) , system_store : SystemStore :: new ( Arc :: clone ( & db ) ) , pruner : Pruner :: new ( Arc :: clone ( & db ) , Self :: NUM_HISTORICAL_VERSIONS_TO_KEEP ) , } }
This creates an empty LibraDB instance on disk or opens one if it already exists.
This creates an empty LibraDB instance on disk or opens one if it already exists .
db_root_path
P
db_root_path
P