pub struct MemoryManagerRangeAuthority { /* private fields */ }Expand description
MemoryManagerRangeAuthority
Substrate-specific range authority policy helper for MemoryManager IDs.
This helper records policy and diagnostic authority ranges only. It never mutates the allocation ledger, and it does not allocate or reserve durable stable-memory slots. Durable allocation remains the generic ledger mapping from stable key to allocation slot.
When used through the default runtime registry, registered ranges are
authoritative generic policy and are checked before caller-supplied
crate::AllocationPolicy. Frameworks that want their own policy to own
application space should avoid registering ranges for that space.
Implementations§
Source§impl MemoryManagerRangeAuthority
impl MemoryManagerRangeAuthority
Sourcepub fn from_records(
records: Vec<MemoryManagerAuthorityRecord>,
) -> Result<Self, MemoryManagerRangeAuthorityError>
pub fn from_records( records: Vec<MemoryManagerAuthorityRecord>, ) -> Result<Self, MemoryManagerRangeAuthorityError>
Build a range authority from diagnostic records.
Records are validated with the same rules as the builder methods and stored in ascending range order.
Sourcepub fn reserve(
self,
range: MemoryManagerIdRange,
authority: impl Into<String>,
) -> Result<Self, MemoryManagerRangeAuthorityError>
pub fn reserve( self, range: MemoryManagerIdRange, authority: impl Into<String>, ) -> Result<Self, MemoryManagerRangeAuthorityError>
Add a reserved authority range.
Reserved is a policy authority mode. It does not allocate every ID in the range and does not write to the allocation ledger.
Sourcepub fn reserve_ids(
self,
start: u8,
end: u8,
authority: impl Into<String>,
) -> Result<Self, MemoryManagerRangeAuthorityError>
pub fn reserve_ids( self, start: u8, end: u8, authority: impl Into<String>, ) -> Result<Self, MemoryManagerRangeAuthorityError>
Add a reserved authority range from inclusive ID bounds.
Reserved is a policy authority mode. It does not allocate every ID in the range and does not write to the allocation ledger.
Sourcepub fn reserve_with_purpose(
self,
range: MemoryManagerIdRange,
authority: impl Into<String>,
purpose: Option<String>,
) -> Result<Self, MemoryManagerRangeAuthorityError>
pub fn reserve_with_purpose( self, range: MemoryManagerIdRange, authority: impl Into<String>, purpose: Option<String>, ) -> Result<Self, MemoryManagerRangeAuthorityError>
Add a reserved authority range with a diagnostic purpose.
Reserved is a policy authority mode. It does not allocate every ID in the range and does not write to the allocation ledger.
Sourcepub fn reserve_ids_with_purpose(
self,
start: u8,
end: u8,
authority: impl Into<String>,
purpose: Option<String>,
) -> Result<Self, MemoryManagerRangeAuthorityError>
pub fn reserve_ids_with_purpose( self, start: u8, end: u8, authority: impl Into<String>, purpose: Option<String>, ) -> Result<Self, MemoryManagerRangeAuthorityError>
Add a reserved authority range from inclusive ID bounds with a diagnostic purpose.
Reserved is a policy authority mode. It does not allocate every ID in the range and does not write to the allocation ledger.
Sourcepub fn allow(
self,
range: MemoryManagerIdRange,
authority: impl Into<String>,
) -> Result<Self, MemoryManagerRangeAuthorityError>
pub fn allow( self, range: MemoryManagerIdRange, authority: impl Into<String>, ) -> Result<Self, MemoryManagerRangeAuthorityError>
Add an allowed authority range.
Allowed is a policy authority mode. It does not allocate any ID in the range and does not write to the allocation ledger.
Sourcepub fn allow_ids(
self,
start: u8,
end: u8,
authority: impl Into<String>,
) -> Result<Self, MemoryManagerRangeAuthorityError>
pub fn allow_ids( self, start: u8, end: u8, authority: impl Into<String>, ) -> Result<Self, MemoryManagerRangeAuthorityError>
Add an allowed authority range from inclusive ID bounds.
Allowed is a policy authority mode. It does not allocate any ID in the range and does not write to the allocation ledger.
Sourcepub fn allow_with_purpose(
self,
range: MemoryManagerIdRange,
authority: impl Into<String>,
purpose: Option<String>,
) -> Result<Self, MemoryManagerRangeAuthorityError>
pub fn allow_with_purpose( self, range: MemoryManagerIdRange, authority: impl Into<String>, purpose: Option<String>, ) -> Result<Self, MemoryManagerRangeAuthorityError>
Add an allowed authority range with a diagnostic purpose.
Allowed is a policy authority mode. It does not allocate any ID in the range and does not write to the allocation ledger.
Sourcepub fn allow_ids_with_purpose(
self,
start: u8,
end: u8,
authority: impl Into<String>,
purpose: Option<String>,
) -> Result<Self, MemoryManagerRangeAuthorityError>
pub fn allow_ids_with_purpose( self, start: u8, end: u8, authority: impl Into<String>, purpose: Option<String>, ) -> Result<Self, MemoryManagerRangeAuthorityError>
Add an allowed authority range from inclusive ID bounds with a diagnostic purpose.
Allowed is a policy authority mode. It does not allocate any ID in the range and does not write to the allocation ledger.
Validate that slot belongs to expected_authority.
Validate that slot belongs to expected_authority with expected_mode.
Validate that id belongs to expected_authority.
Validate that id belongs to expected_authority with expected_mode.
Return the authority record that governs id, if any.
Ordered non-overlapping authority records.
This is the stable diagnostic/export surface for the authority table. Records are returned in ascending range order and do not imply ledger allocation state.
Sourcepub fn validate_complete_coverage(
&self,
target: MemoryManagerIdRange,
) -> Result<(), MemoryManagerRangeAuthorityError>
pub fn validate_complete_coverage( &self, target: MemoryManagerIdRange, ) -> Result<(), MemoryManagerRangeAuthorityError>
Validate that authority records exactly and contiguously cover target.
All records must be inside target, and together they must form a
gap-free partition. This checks policy table coverage only and never
changes allocation ledger state.
Trait Implementations§
Source§impl Clone for MemoryManagerRangeAuthority
impl Clone for MemoryManagerRangeAuthority
Source§fn clone(&self) -> MemoryManagerRangeAuthority
fn clone(&self) -> MemoryManagerRangeAuthority
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MemoryManagerRangeAuthority
impl Debug for MemoryManagerRangeAuthority
Source§impl Default for MemoryManagerRangeAuthority
impl Default for MemoryManagerRangeAuthority
Source§fn default() -> MemoryManagerRangeAuthority
fn default() -> MemoryManagerRangeAuthority
Source§impl<'de> Deserialize<'de> for MemoryManagerRangeAuthority
impl<'de> Deserialize<'de> for MemoryManagerRangeAuthority
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for MemoryManagerRangeAuthority
impl PartialEq for MemoryManagerRangeAuthority
Source§fn eq(&self, other: &MemoryManagerRangeAuthority) -> bool
fn eq(&self, other: &MemoryManagerRangeAuthority) -> bool
self and other values to be equal, and is used by ==.