@@ -118,12 +118,16 @@ pub enum RestartPolicy {
118118 } ,
119119 /// Restart the failed actor and all its siblings (children of the same parent).
120120 OneForAll {
121+ /// Maximum restart attempts within the time window.
121122 max_restarts : u32 ,
123+ /// Time window for counting restarts.
122124 window : Duration ,
123125 } ,
124126 /// Restart the failed actor and all actors that were started after it.
125127 RestForOne {
128+ /// Maximum restart attempts within the time window.
126129 max_restarts : u32 ,
130+ /// Time window for counting restarts.
127131 window : Duration ,
128132 } ,
129133}
@@ -537,7 +541,7 @@ impl ActorSupervisor {
537541 } ) ;
538542 }
539543
540- RestartPolicy :: OneForOne { max_restarts , .. } => {
544+ RestartPolicy :: OneForOne { .. } => {
541545 // Restart only the failed actor
542546 match self . restart_actor ( failed_id, config) {
543547 Ok ( new_id) => {
@@ -666,35 +670,56 @@ pub enum SupervisionAction {
666670 /// Actor marked as failed.
667671 MarkedFailed ( ActorId ) ,
668672 /// Actor was restarted.
669- Restarted { old_id : ActorId , new_id : ActorId } ,
673+ Restarted {
674+ /// The original actor ID before restart.
675+ old_id : ActorId ,
676+ /// The new actor ID after restart.
677+ new_id : ActorId ,
678+ } ,
670679 /// A sibling was destroyed (OneForAll/RestForOne).
671680 DestroyedSibling ( ActorId ) ,
672681 /// All siblings destroyed, parent needs to re-create them.
673- AllSiblingsDestroyed { parent : ActorId } ,
682+ AllSiblingsDestroyed {
683+ /// Parent actor that owns the destroyed siblings.
684+ parent : ActorId ,
685+ } ,
674686 /// Failure escalated to parent supervisor.
675- Escalated { failed : ActorId , escalated_to : Option < ActorId > } ,
687+ Escalated {
688+ /// Actor that failed.
689+ failed : ActorId ,
690+ /// Parent supervisor the failure was escalated to.
691+ escalated_to : Option < ActorId > ,
692+ } ,
676693}
677694
678695/// Errors from actor lifecycle operations.
679696#[ derive( Debug , Clone ) ]
680697pub enum ActorError {
681698 /// No available actor slots in the pool.
682699 PoolExhausted {
700+ /// Total pool capacity.
683701 capacity : u32 ,
702+ /// Number of currently active actors.
684703 active : u32 ,
685704 } ,
686705 /// Invalid actor ID.
687706 InvalidId ( ActorId ) ,
688707 /// Invalid state transition.
689708 InvalidStateTransition {
709+ /// Actor that attempted the invalid transition.
690710 actor : ActorId ,
711+ /// Current state of the actor.
691712 from : ActorState ,
713+ /// Attempted target state.
692714 to : ActorState ,
693715 } ,
694716 /// Actor has exceeded its maximum restart budget.
695717 MaxRestartsExceeded {
718+ /// Actor that exceeded its restart budget.
696719 actor : ActorId ,
720+ /// Number of restarts attempted.
697721 restarts : u32 ,
722+ /// Maximum allowed restarts.
698723 max : u32 ,
699724 } ,
700725}
0 commit comments