Struct ActorSupervisor
pub struct ActorSupervisor {
entries: Vec<SupervisionEntry>,
free_list: Vec<u32>,
capacity: u32,
active_count: u32,
}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.
Fields§
§entries: Vec<SupervisionEntry>§free_list: Vec<u32>§capacity: u32§active_count: u32Implementations§
§impl ActorSupervisor
impl ActorSupervisor
pub fn new(grid_size: u32) -> ActorSupervisor
pub fn new(grid_size: u32) -> ActorSupervisor
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.
pub 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.
pub 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).
pub 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.
pub 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).
pub 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.
pub fn children_of(&self, parent: ActorId) -> Vec<ActorId>
pub fn children_of(&self, parent: ActorId) -> Vec<ActorId>
Get children of a given actor.
pub fn get(&self, id: ActorId) -> Option<&SupervisionEntry>
pub fn get(&self, id: ActorId) -> Option<&SupervisionEntry>
Get the supervision entry for an actor.
pub fn active_count(&self) -> u32
pub fn active_count(&self) -> u32
Number of currently active actors.
pub fn available_count(&self) -> u32
pub fn available_count(&self) -> u32
Number of available (dormant) actor slots.
pub fn entries(&self) -> &[SupervisionEntry]
pub fn entries(&self) -> &[SupervisionEntry]
Get all supervision entries as a slice (for copying to mapped memory).
pub 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.
pub 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).
Auto Trait Implementations§
impl Freeze for ActorSupervisor
impl RefUnwindSafe for ActorSupervisor
impl Send for ActorSupervisor
impl Sync for ActorSupervisor
impl Unpin for ActorSupervisor
impl UnwindSafe for ActorSupervisor
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more