pub fn open(path: PathBuf) -> Result<LedgerDB, Error> {
        let env = Environment::new()
            .set_max_dbs(20)
            .set_map_size(MAX_LMDB_FILE_SIZE)
            // TODO - needed because currently our test cloud machines have slow disks.
            .set_flags(EnvironmentFlags::NO_SYNC)
            .open(&path)?;

        let counts = env.open_db(Some(COUNTS_DB_NAME))?;
        let blocks = env.open_db(Some(BLOCKS_DB_NAME))?;
        let block_contents = env.open_db(Some(BLOCK_CONTENTS_DB_NAME))?;
        let block_signatures = env.open_db(Some(BLOCK_SIGNATURES_DB_NAME))?;
        let key_images = env.open_db(Some(KEY_IMAGES_DB_NAME))?;
        let key_images_by_block = env.open_db(Some(KEY_IMAGES_BY_BLOCK_DB_NAME))?;

        let tx_out_store = TxOutStore::new(&env)?;

        Ok(LedgerDB {
            env: Arc::new(env),
            path,
            counts,
            blocks,
            block_contents,
            block_signatures,
            key_images,
            key_images_by_block,
            tx_out_store,
        })
    }
/// Opens an existing Ledger Database in the given path.
Opens an existing Ledger Database in the given path.
Opens an existing Ledger Database in the given path .
pub fn open(path: PathBuf) -> Result<LedgerDB, Error> {
        let env = Environment::new()
            .set_max_dbs(20)
            .set_map_size(MAX_LMDB_FILE_SIZE)
            // TODO - needed because currently our test cloud machines have slow disks.
            .set_flags(EnvironmentFlags::NO_SYNC)
            .open(&path)?;
        let counts = env.open_db(Some(COUNTS_DB_NAME))?;
        let blocks = env.open_db(Some(BLOCKS_DB_NAME))?;
        let block_contents = env.open_db(Some(BLOCK_CONTENTS_DB_NAME))?;
        let block_signatures = env.open_db(Some(BLOCK_SIGNATURES_DB_NAME))?;
        let key_images = env.open_db(Some(KEY_IMAGES_DB_NAME))?;
        let key_images_by_block = env.open_db(Some(KEY_IMAGES_BY_BLOCK_DB_NAME))?;
        let tx_out_store = TxOutStore::new(&env)?;
        Ok(LedgerDB {
            env: Arc::new(env),
            path,
            counts,
            blocks,
            block_contents,
            block_signatures,
            key_images,
            key_images_by_block,
            tx_out_store,
        })
    }
pub fn open ( path : PathBuf ) -> Result < LedgerDB , Error > { let env = Environment :: new ( ) . set_max_dbs ( 20 ) . set_map_size ( MAX_LMDB_FILE_SIZE ) // TODO - needed because currently our test cloud machines have slow disks. . set_flags ( EnvironmentFlags :: NO_SYNC ) . open ( & path ) ? ; let counts = env . open_db ( Some ( COUNTS_DB_NAME ) ) ? ; let blocks = env . open_db ( Some ( BLOCKS_DB_NAME ) ) ? ; let block_contents = env . open_db ( Some ( BLOCK_CONTENTS_DB_NAME ) ) ? ; let block_signatures = env . open_db ( Some ( BLOCK_SIGNATURES_DB_NAME ) ) ? ; let key_images = env . open_db ( Some ( KEY_IMAGES_DB_NAME ) ) ? ; let key_images_by_block = env . open_db ( Some ( KEY_IMAGES_BY_BLOCK_DB_NAME ) ) ? ; let tx_out_store = TxOutStore :: new ( & env ) ? ; Ok ( LedgerDB { env : Arc :: new ( env ) , path , counts , blocks , block_contents , block_signatures , key_images , key_images_by_block , tx_out_store , } ) }
Opens an existing Ledger Database in the given path.
Opens an existing Ledger Database in the given path .
path
PathBuf
path
PathBuf