pub fn create_runtime_env(
store: &Store,
context_id: ContextId,
executor_id: PublicKey,
) -> RuntimeEnvExpand description
Create a RuntimeEnv that bridges calimero-storage to a Store.
This is the canonical way to set up storage access for sync protocols.
The returned RuntimeEnv can be used with with_runtime_env() to enable
Index<MainStorage> and Interface<MainStorage> operations.
§Arguments
store- The underlying store (works with both RocksDB and InMemoryDB)context_id- The context being accessedexecutor_id- The identity executing operations
§Example
ⓘ
let env = create_runtime_env(&store, context_id, identity);
let result = with_runtime_env(env, || {
Index::<MainStorage>::get_index(entity_id)
});