pub struct ActorSupervisor { /* private fields */ }Expand description
The supervisor manages the actor pool lifecycle.
This is the host-side component. The GPU-side supervisor runs as block 0 in the persistent kernel and mirrors this state.
Implementations§
Source§impl ActorSupervisor
impl ActorSupervisor
Sourcepub fn new(grid_size: u32) -> Self
pub fn new(grid_size: u32) -> Self
Create a supervisor for a persistent kernel with grid_size blocks.
Block 0 is reserved for the supervisor itself. Blocks 1..grid_size are available as actor slots.
Sourcepub fn create_actor(
&mut self,
config: &ActorConfig,
parent_id: Option<ActorId>,
) -> Result<ActorId, ActorError>
pub fn create_actor( &mut self, config: &ActorConfig, parent_id: Option<ActorId>, ) -> Result<ActorId, ActorError>
Create a new actor, returning its ID.
Allocates a dormant slot from the free pool, initializes it with the given config, and sets its state to Initializing.
Sourcepub fn activate_actor(&mut self, id: ActorId) -> Result<(), ActorError>
pub fn activate_actor(&mut self, id: ActorId) -> Result<(), ActorError>
Activate an actor (transition from Initializing to Active).
Sourcepub fn destroy_actor(&mut self, id: ActorId) -> Result<(), ActorError>
pub fn destroy_actor(&mut self, id: ActorId) -> Result<(), ActorError>
Destroy an actor, returning its slot to the free pool.
Sourcepub fn restart_actor(
&mut self,
id: ActorId,
config: &ActorConfig,
) -> Result<ActorId, ActorError>
pub fn restart_actor( &mut self, id: ActorId, config: &ActorConfig, ) -> Result<ActorId, ActorError>
Restart an actor (destroy + re-create with same config).
Returns the new ActorId (may be the same slot if available).
Sourcepub fn check_heartbeats(&self, now_ns: u64, timeout_ns: u64) -> Vec<ActorId>
pub fn check_heartbeats(&self, now_ns: u64, timeout_ns: u64) -> Vec<ActorId>
Check for actors that have missed their heartbeat deadline.
Returns a list of actor IDs that should be restarted.
Sourcepub fn children_of(&self, parent: ActorId) -> Vec<ActorId>
pub fn children_of(&self, parent: ActorId) -> Vec<ActorId>
Get children of a given actor.
Sourcepub fn get(&self, id: ActorId) -> Option<&SupervisionEntry>
pub fn get(&self, id: ActorId) -> Option<&SupervisionEntry>
Get the supervision entry for an actor.
Sourcepub fn active_count(&self) -> u32
pub fn active_count(&self) -> u32
Number of currently active actors.
Sourcepub fn available_count(&self) -> u32
pub fn available_count(&self) -> u32
Number of available (dormant) actor slots.
Sourcepub fn entries(&self) -> &[SupervisionEntry]
pub fn entries(&self) -> &[SupervisionEntry]
Get all supervision entries as a slice (for copying to mapped memory).
Sourcepub fn kill_tree(&mut self, root: ActorId) -> Vec<ActorId>
pub fn kill_tree(&mut self, root: ActorId) -> Vec<ActorId>
Cascading kill: destroy an actor and all its descendants.
Walks the supervision tree depth-first, destroying children before parents. Returns the list of destroyed actor IDs.
Sourcepub fn handle_failure(
&mut self,
failed_id: ActorId,
config: &ActorConfig,
) -> Vec<SupervisionAction>
pub fn handle_failure( &mut self, failed_id: ActorId, config: &ActorConfig, ) -> Vec<SupervisionAction>
Handle a failed actor according to its parent’s restart policy.
Returns a list of actions taken (for logging/auditing).