pub fn create_execution_engine(
    ee_lmdb_path: impl AsRef<Path>,
    default_max_db_size: usize,
    manual_sync_enabled: bool,
) -> Result<(Arc<EngineState<LmdbGlobalState>>, Arc<LmdbEnvironment>), anyhow::Error> {
    if !ee_lmdb_path.as_ref().exists() {
        println!(
            "creating new lmdb data dir {}",
            ee_lmdb_path.as_ref().display()
        );
        fs::create_dir_all(&ee_lmdb_path)?;
    }
    fs::create_dir_all(&ee_lmdb_path)?;
    let lmdb_environment =
        create_lmdb_environment(&ee_lmdb_path, default_max_db_size, manual_sync_enabled)?;
    lmdb_environment.env().sync(true)?;

    let lmdb_trie_store = Arc::new(LmdbTrieStore::new(
        &lmdb_environment,
        None,
        DatabaseFlags::empty(),
    )?);
    let global_state = LmdbGlobalState::empty(Arc::clone(&lmdb_environment), lmdb_trie_store)?;

    Ok((
        Arc::new(EngineState::new(global_state, EngineConfig::default())),
        lmdb_environment,
    ))
}
/// Creates a new execution engine.
Creates a new execution engine.
Creates a new execution engine .
pub fn create_execution_engine(
    ee_lmdb_path: impl AsRef<Path>,
    default_max_db_size: usize,
    manual_sync_enabled: bool,
) -> Result<(Arc<EngineState<LmdbGlobalState>>, Arc<LmdbEnvironment>), anyhow::Error> {
    if !ee_lmdb_path.as_ref().exists() {
        println!(
            "creating new lmdb data dir {}",
            ee_lmdb_path.as_ref().display()
        );
        fs::create_dir_all(&ee_lmdb_path)?;
    }
    fs::create_dir_all(&ee_lmdb_path)?;
    let lmdb_environment =
        create_lmdb_environment(&ee_lmdb_path, default_max_db_size, manual_sync_enabled)?;
    lmdb_environment.env().sync(true)?;
    let lmdb_trie_store = Arc::new(LmdbTrieStore::new(
        &lmdb_environment,
        None,
        DatabaseFlags::empty(),
    )?);
    let global_state = LmdbGlobalState::empty(Arc::clone(&lmdb_environment), lmdb_trie_store)?;
    Ok((
        Arc::new(EngineState::new(global_state, EngineConfig::default())),
        lmdb_environment,
    ))
}
pub fn create_execution_engine ( ee_lmdb_path : impl AsRef < Path > , default_max_db_size : usize , manual_sync_enabled : bool , ) -> Result < ( Arc < EngineState < LmdbGlobalState > > , Arc < LmdbEnvironment > ) , anyhow :: Error > { if ! ee_lmdb_path . as_ref ( ) . exists ( ) { println ! ( " " ee_lmdb_path as_ref ( ) display ( ) ) ; fs :: create_dir_all ( & ee_lmdb_path ) ? ; } fs :: create_dir_all ( & ee_lmdb_path ) ? ; let lmdb_environment = create_lmdb_environment ( & ee_lmdb_path , default_max_db_size , manual_sync_enabled ) ? ; lmdb_environment . env ( ) . sync ( true ) ? ; let lmdb_trie_store = Arc :: new ( LmdbTrieStore :: new ( & lmdb_environment , None , DatabaseFlags :: empty ( ) , ) ? ) ; let global_state = LmdbGlobalState :: empty ( Arc :: clone ( & lmdb_environment ) , lmdb_trie_store ) ? ; Ok ( ( Arc :: new ( EngineState :: new ( global_state , EngineConfig :: default ( ) ) ) , lmdb_environment , ) ) }
Creates a new execution engine.
Creates a new execution engine .
ee_lmdb_path
impl AsRef<Path>
default_max_db_size
usize
manual_sync_enabled
bool
ee_lmdb_path
impl AsRef<Path>
default_max_db_size
usize
manual_sync_enabled
bool