import { Actor, ActorRef, TerminationReason } from "./actor.js"; import { ActorSystem } from "./actor_system.js"; /** * Handles supervision of child actors within a supervision tree. * Implements one-for-one, one-for-all, and rest-for-one strategies. */ export declare class ChildSupervisor { private readonly system; private readonly restartCounts; private readonly log; constructor(system: ActorSystem); /** * Generates a stable key for tracking restarts. * Uses parent ID + child name or original spawn args as identifier. */ private getRestartKey; /** * Handles a child actor crash according to the parent's supervision strategy. * @param childRef The crashed child actor * @param error The error that caused the crash */ handleChildCrash(childRef: ActorRef, error: any): Promise; /** * Checks if an actor can be restarted based on restart limits. * @param restartKey Stable key for tracking restarts across actor ID changes */ private canRestart; /** * One-for-one: Only restart the crashed child. */ private handleOneForOne; /** * One-for-all: Restart all children if one crashes. */ private handleOneForAll; /** * Rest-for-one: Restart the crashed child and all children started after it. */ private handleRestForOne; /** * Clears restart count for an actor (e.g., when manually stopped). */ clearRestartCount(actorId: string): void; /** * Handles a crash notification for a remote child. * Called when a child on a remote node has crashed. */ handleRemoteChildCrash(remoteChild: RemoteChildEntry, reason: TerminationReason, errorMessage?: string): Promise; /** * Generates a stable key for tracking remote child restarts. */ private getRestartKeyForRemote; /** * One-for-one strategy for remote child. */ private handleRemoteOneForOne; /** * One-for-all strategy for remote children. * Restarts all children (local and remote) when one crashes. */ private handleRemoteOneForAll; /** * Rest-for-one strategy for remote children. * Restarts the crashed child and all children started after it. */ private handleRemoteRestForOne; } /** * Information about a child actor spawned on a remote node. * Re-exported from actor_system for use in this module. */ export interface RemoteChildEntry { childRef: ActorRef; childNodeId: string; parentRef: ActorRef; actorClass: new () => Actor; options: { name?: string; args?: any[]; }; } //# sourceMappingURL=child_supervisor.d.ts.map