pub fn load_execution_engine(
    ee_lmdb_path: impl AsRef<Path>,
    default_max_db_size: usize,
    state_root_hash: Digest,
    manual_sync_enabled: bool,
) -> Result<(Arc<EngineState<LmdbGlobalState>>, Arc<LmdbEnvironment>), anyhow::Error> {
    let lmdb_data_file = ee_lmdb_path.as_ref().join("data.lmdb");
    if !ee_lmdb_path.as_ref().join("data.lmdb").exists() {
        return Err(anyhow::anyhow!(
            "lmdb data file not found at: {}",
            lmdb_data_file.display()
        ));
    }
    let lmdb_environment =
        create_lmdb_environment(&ee_lmdb_path, default_max_db_size, manual_sync_enabled)?;
    let lmdb_trie_store = Arc::new(LmdbTrieStore::open(&lmdb_environment, None)?);
    let global_state = LmdbGlobalState::new(
        Arc::clone(&lmdb_environment),
        lmdb_trie_store,
        state_root_hash,
    );
    Ok((
        Arc::new(EngineState::new(global_state, EngineConfig::default())),
        lmdb_environment,
    ))
}
/// Loads an existing execution engine.
Loads an existing execution engine.
Loads an existing execution engine .
pub fn load_execution_engine(
    ee_lmdb_path: impl AsRef<Path>,
    default_max_db_size: usize,
    state_root_hash: Digest,
    manual_sync_enabled: bool,
) -> Result<(Arc<EngineState<LmdbGlobalState>>, Arc<LmdbEnvironment>), anyhow::Error> {
    let lmdb_data_file = ee_lmdb_path.as_ref().join("data.lmdb");
    if !ee_lmdb_path.as_ref().join("data.lmdb").exists() {
        return Err(anyhow::anyhow!(
            "lmdb data file not found at: {}",
            lmdb_data_file.display()
        ));
    }
    let lmdb_environment =
        create_lmdb_environment(&ee_lmdb_path, default_max_db_size, manual_sync_enabled)?;
    let lmdb_trie_store = Arc::new(LmdbTrieStore::open(&lmdb_environment, None)?);
    let global_state = LmdbGlobalState::new(
        Arc::clone(&lmdb_environment),
        lmdb_trie_store,
        state_root_hash,
    );
    Ok((
        Arc::new(EngineState::new(global_state, EngineConfig::default())),
        lmdb_environment,
    ))
}
pub fn load_execution_engine ( ee_lmdb_path : impl AsRef < Path > , default_max_db_size : usize , state_root_hash : Digest , manual_sync_enabled : bool , ) -> Result < ( Arc < EngineState < LmdbGlobalState > > , Arc < LmdbEnvironment > ) , anyhow :: Error > { let lmdb_data_file = ee_lmdb_path . as_ref ( ) . join ( " " ) ; if ! ee_lmdb_path . as_ref ( ) . join ( " " ) . exists ( ) { return Err ( anyhow :: anyhow ! ( " " lmdb_data_file display ( ) ) ) ; } let lmdb_environment = create_lmdb_environment ( & ee_lmdb_path , default_max_db_size , manual_sync_enabled ) ? ; let lmdb_trie_store = Arc :: new ( LmdbTrieStore :: open ( & lmdb_environment , None ) ? ) ; let global_state = LmdbGlobalState :: new ( Arc :: clone ( & lmdb_environment ) , lmdb_trie_store , state_root_hash , ) ; Ok ( ( Arc :: new ( EngineState :: new ( global_state , EngineConfig :: default ( ) ) ) , lmdb_environment , ) ) }
Loads an existing execution engine.
Loads an existing execution engine .
ee_lmdb_path
impl AsRef<Path>
default_max_db_size
usize
state_root_hash
Digest
manual_sync_enabled
bool
ee_lmdb_path
impl AsRef<Path>
default_max_db_size
usize
state_root_hash
Digest
manual_sync_enabled
bool