ic_memory/runtime/
policy.rs1use crate::{
2 MemoryManagerSlot, PolicyIdentity, PolicyIdentityError, RuntimeBootstrapPolicy, StableKey,
3};
4use std::convert::Infallible;
5
6pub struct GenericAllocationPolicy;
18
19impl RuntimeBootstrapPolicy for GenericAllocationPolicy {
20 type Error = Infallible;
21
22 fn validate_key(&self, _key: &StableKey) -> Result<(), Self::Error> {
23 Ok(())
24 }
25
26 fn validate_slot(
27 &self,
28 _key: &StableKey,
29 _slot: &MemoryManagerSlot,
30 ) -> Result<(), Self::Error> {
31 Ok(())
32 }
33
34 fn runtime_bootstrap_identity(&self) -> Result<PolicyIdentity, PolicyIdentityError> {
35 PolicyIdentity::new("ic-memory.noop-policy", 1)
36 }
37}