pub struct MemoryRuntime<M: Memory> { /* private fields */ }Expand description
MemoryRuntime
One custodian of named allocations on a backing. Bootstrap validates namespace grants and host policy, commits bindings, then permits exclusive leases. Omitted retained names keep their allocation, but require current admission before opening. IDs are opaque u64 values, never selected by applications.
Implementations§
Source§impl<M: Memory> MemoryRuntime<M>
impl<M: Memory> MemoryRuntime<M>
Sourcepub fn new(memory: M) -> Result<Self, RuntimeConstructionError>where
M: MemoryBacking,
pub fn new(memory: M) -> Result<Self, RuntimeConstructionError>where
M: MemoryBacking,
Claim backing and create or read its owned directory. Never reset nonempty backing.
§Errors
Rejects duplicate backing custody or invalid/non-admissible retained directory data.
Sourcepub fn new_with_config(
memory: M,
config: StorageConfig,
) -> Result<Self, RuntimeConstructionError>where
M: MemoryBacking,
pub fn new_with_config(
memory: M,
config: StorageConfig,
) -> Result<Self, RuntimeConstructionError>where
M: MemoryBacking,
Use explicit directory resource limits; reopening revalidates under those limits.
§Errors
Rejects duplicate backing custody, invalid configuration, or invalid/non-admissible retained directory data.
Sourcepub const fn is_bootstrapped(&self) -> bool
pub const fn is_bootstrapped(&self) -> bool
Whether current host authority has been committed.
Sourcepub fn committed_generation(&self) -> Result<u64, RuntimeOpenError>
pub fn committed_generation(&self) -> Result<u64, RuntimeOpenError>
Current durable directory generation, after bootstrap admission.
§Errors
Returns NotBootstrapped until bootstrap establishes a binding.
Sourcepub const fn config(&self) -> StorageConfig
pub const fn config(&self) -> StorageConfig
Effective resource admission limits.
Sourcepub fn bootstrap<P: RuntimeBootstrapPolicy>(
&mut self,
source: &SealedDeclarationSnapshot,
grants: &AllocationGrants,
policy: &P,
) -> Result<u64, RuntimeBootstrapError<P::Error>>
pub fn bootstrap<P: RuntimeBootstrapPolicy>( &mut self, source: &SealedDeclarationSnapshot, grants: &AllocationGrants, policy: &P, ) -> Result<u64, RuntimeBootstrapError<P::Error>>
Admit a complete declaration set, retaining omitted historical bindings.
§Errors
Rejects invalid grants or declarations, host-policy refusal, conflicting bindings, and directory validation or commitment failures.
Sourcepub fn verify_bootstrap<P: RuntimeBootstrapPolicy>(
&self,
source: &SealedDeclarationSnapshot,
grants: &AllocationGrants,
policy: &P,
) -> Result<u64, RuntimeBootstrapError<P::Error>>
pub fn verify_bootstrap<P: RuntimeBootstrapPolicy>( &self, source: &SealedDeclarationSnapshot, grants: &AllocationGrants, policy: &P, ) -> Result<u64, RuntimeBootstrapError<P::Error>>
Compare the complete established binding without IO or policy callbacks.
§Errors
Returns NotBootstrapped or BindingMismatch when the supplied composition differs from the established binding.
Sourcepub fn open_memory(
&self,
key: &StableKey,
) -> Result<RuntimeMemory<M>, RuntimeOpenError>
pub fn open_memory( &self, key: &StableKey, ) -> Result<RuntimeMemory<M>, RuntimeOpenError>
Verify component requirements against current host admission without IO.
§Errors
Rejects unbootstrapped access or requirements not admitted under the requested authority.
Sourcepub fn allocation_id(&self, key: &StableKey) -> Option<AllocationId>
pub fn allocation_id(&self, key: &StableKey) -> Option<AllocationId>
Resolve a retained identity for diagnostics; this grants no access.
Sourcepub fn memory_allocations(
&self,
) -> Result<Vec<MemoryAllocation>, DirectoryError>
pub fn memory_allocations( &self, ) -> Result<Vec<MemoryAllocation>, DirectoryError>
Observe checked directory entries and actual logical extents.
§Errors
Returns a directory error when ownership is poisoned or the retained directory fails validation.
Sourcepub fn diagnostics(&self) -> Result<StorageDiagnostics, DirectoryError>
pub fn diagnostics(&self) -> Result<StorageDiagnostics, DirectoryError>
Validate the current directory and report physical capacity and custody. Available before bootstrap; collecting diagnostics never admits or opens a key. Page totals describe reserved capacity, not application payload occupancy.
§Errors
Rejects a poisoned owner or backing that no longer matches its directory.