pub struct ComposedRuntime { /* private fields */ }Expand description
Runtime wrapper for composed protocol execution.
Implementations§
Source§impl ComposedRuntime
impl ComposedRuntime
Sourcepub fn new(config: ProtocolMachineConfig, budget: MemoryBudget) -> Self
pub fn new(config: ProtocolMachineConfig, budget: MemoryBudget) -> Self
Create an empty composed runtime.
Sourcepub fn admit_bundle(
&mut self,
bundle: ProtocolBundle,
) -> Result<(), CompositionError>
pub fn admit_bundle( &mut self, bundle: ProtocolBundle, ) -> Result<(), CompositionError>
Admit a protocol bundle after certificate + budget checks.
§Errors
Returns a CompositionError when proof or budget checks fail.
Sourcepub fn load_bundle_session(
&mut self,
bundle_idx: usize,
) -> Result<usize, CompositionError>
pub fn load_bundle_session( &mut self, bundle_idx: usize, ) -> Result<usize, CompositionError>
Load one session instance from an admitted bundle index.
§Errors
Returns a CompositionError when index is invalid or ProtocolMachine loading fails.
Sourcepub fn load_bundle_sessions(
&mut self,
bundle_idx: usize,
sessions: usize,
) -> Result<Vec<usize>, CompositionError>
pub fn load_bundle_sessions( &mut self, bundle_idx: usize, sessions: usize, ) -> Result<Vec<usize>, CompositionError>
Load sessions instances from a bundle index.
§Errors
Returns a CompositionError when any session load fails.
Sourcepub fn run(
&mut self,
handler: &dyn EffectHandler,
max_steps: usize,
) -> Result<(), CompositionError>
pub fn run( &mut self, handler: &dyn EffectHandler, max_steps: usize, ) -> Result<(), CompositionError>
Sourcepub fn memory_usage(&self) -> &MemoryUsage
pub fn memory_usage(&self) -> &MemoryUsage
Access current memory usage snapshot.
Sourcepub fn bundles(&self) -> &[ProtocolBundle]
pub fn bundles(&self) -> &[ProtocolBundle]
Access admitted bundles.
Sourcepub fn seed_bundle_membership<I, S>(
&mut self,
bundle_idx: usize,
members: I,
) -> Result<(), CompositionError>
pub fn seed_bundle_membership<I, S>( &mut self, bundle_idx: usize, members: I, ) -> Result<(), CompositionError>
Seed the active membership set for one admitted reconfiguration-enabled bundle.
§Errors
Returns a CompositionError when the bundle index is invalid, reconfiguration is disabled,
or the membership set is empty.
Sourcepub fn reconfigure_bundle<I, S>(
&mut self,
bundle_idx: usize,
next_members: I,
) -> Result<ReconfigurationEvent, CompositionError>
pub fn reconfigure_bundle<I, S>( &mut self, bundle_idx: usize, next_members: I, ) -> Result<ReconfigurationEvent, CompositionError>
Apply one deterministic reconfiguration transition to an admitted bundle.
§Errors
Returns a CompositionError when the bundle index is invalid, the bundle does not admit
reconfiguration, the transition violates required overlap, or the new membership set is
empty.
Sourcepub fn bundle_members(&self, bundle_idx: usize) -> Option<&BTreeSet<String>>
pub fn bundle_members(&self, bundle_idx: usize) -> Option<&BTreeSet<String>>
The canonical sorted active member set for one bundle, if configured.
Sourcepub fn bundle_reconfiguration_history(
&self,
bundle_idx: usize,
) -> Option<&[ReconfigurationEvent]>
pub fn bundle_reconfiguration_history( &self, bundle_idx: usize, ) -> Option<&[ReconfigurationEvent]>
The deterministic reconfiguration history for one bundle, if configured.
Sourcepub fn execute_reconfiguration_plan(
&mut self,
bundle_idx: usize,
plan: &ReconfigurationPlan,
) -> Result<ReconfigurationPlanExecution, CompositionError>
pub fn execute_reconfiguration_plan( &mut self, bundle_idx: usize, plan: &ReconfigurationPlan, ) -> Result<ReconfigurationPlanExecution, CompositionError>
Execute one deterministic multi-step reconfiguration plan atomically.
§Errors
Returns a CompositionError when any plan step is invalid or violates the admitted policy.
Sourcepub fn bundle_reconfiguration_plan_executions(
&self,
bundle_idx: usize,
) -> Option<&[ReconfigurationPlanExecution]>
pub fn bundle_reconfiguration_plan_executions( &self, bundle_idx: usize, ) -> Option<&[ReconfigurationPlanExecution]>
The deterministic reconfiguration plan executions for one bundle, if configured.
Sourcepub fn execute_runtime_upgrade(
&mut self,
bundle_idx: usize,
request: &RuntimeUpgradeRequest,
) -> Result<RuntimeUpgradeExecution, CompositionError>
pub fn execute_runtime_upgrade( &mut self, bundle_idx: usize, request: &RuntimeUpgradeRequest, ) -> Result<RuntimeUpgradeExecution, CompositionError>
Execute one deterministic runtime-upgrade request as a specialized reconfiguration.
§Errors
Returns a CompositionError when compatibility checks or any plan step fails.
Sourcepub fn bundle_runtime_upgrade_executions(
&self,
bundle_idx: usize,
) -> Option<&[RuntimeUpgradeExecution]>
pub fn bundle_runtime_upgrade_executions( &self, bundle_idx: usize, ) -> Option<&[RuntimeUpgradeExecution]>
Deterministic runtime-upgrade executions for one bundle, if configured.
Sourcepub fn bundle_reconfiguration_snapshot(
&self,
bundle_idx: usize,
) -> Option<ReconfigurationRuntimeSnapshot>
pub fn bundle_reconfiguration_snapshot( &self, bundle_idx: usize, ) -> Option<ReconfigurationRuntimeSnapshot>
Export a deterministic snapshot of the reconfiguration state for one bundle.
Sourcepub fn restore_bundle_reconfiguration_snapshot(
&mut self,
bundle_idx: usize,
snapshot: ReconfigurationRuntimeSnapshot,
) -> Result<(), CompositionError>
pub fn restore_bundle_reconfiguration_snapshot( &mut self, bundle_idx: usize, snapshot: ReconfigurationRuntimeSnapshot, ) -> Result<(), CompositionError>
Restore a previously exported reconfiguration snapshot for one admitted bundle.
§Errors
Returns a CompositionError when the snapshot is inconsistent with the admitted policy.
Sourcepub fn machine(&self) -> &ProtocolMachine
pub fn machine(&self) -> &ProtocolMachine
Access underlying ProtocolMachine.