use crate::*;
#[cfg(not(target_arch = "wasm32"))]
mod metered_memory;
#[cfg(not(target_arch = "wasm32"))]
pub use metered_memory::{MemoryIoCounts, MeteredMemory};
pub fn fixture_runtime<M: MemoryBacking>(
memory: M,
authority: &str,
prefix: &str,
keys: &[&str],
config: StorageConfig,
) -> Result<MemoryRuntime<M>, Box<dyn std::error::Error>> {
let mut runtime = MemoryRuntime::new_with_config(memory, config)?;
let source = SealedDeclarationSnapshot::new(
keys.iter()
.map(|key| MemoryRequest::new(authority, key))
.collect::<Result<Vec<_>, _>>()?,
)?;
let grants = AllocationGrants::new(vec![MemoryAuthority::new(authority, prefix)?])?;
runtime.bootstrap(&source, &grants, &GenericAllocationPolicy)?;
Ok(runtime)
}