pub struct ActorRuntime {
pub actor_id: TheaterId,
pub handler_tasks: Vec<JoinHandle<()>>,
pub shutdown_controller: ShutdownController,
}Expand description
§ActorRuntime
Coordinates the execution and lifecycle of a single WebAssembly actor within the Theater system.
ActorRuntime manages the various components that make up an actor’s execution environment,
including handlers and communication channels. It’s responsible for starting the actor,
setting up its capabilities via handlers, executing operations, and ensuring proper shutdown.
Fields§
§actor_id: TheaterIdUnique identifier for this actor
handler_tasks: Vec<JoinHandle<()>>Handles to the running handler tasks
shutdown_controller: ShutdownControllerController for graceful shutdown of all components
Implementations§
Source§impl ActorRuntime
impl ActorRuntime
Sourcepub async fn start(
id: TheaterId,
config: &ManifestConfig,
state_bytes: Option<Vec<u8>>,
theater_tx: Sender<TheaterCommand>,
actor_sender: Sender<ActorMessage>,
actor_mailbox: Receiver<ActorMessage>,
operation_rx: Receiver<ActorOperation>,
operation_tx: Sender<ActorOperation>,
info_rx: Receiver<ActorInfo>,
info_tx: Sender<ActorInfo>,
control_rx: Receiver<ActorControl>,
control_tx: Sender<ActorControl>,
init: bool,
parent_shutdown_receiver: ShutdownReceiver,
response_tx: Sender<StartActorResult>,
engine: Engine,
parent_permissions: HandlerPermission,
)
pub async fn start( id: TheaterId, config: &ManifestConfig, state_bytes: Option<Vec<u8>>, theater_tx: Sender<TheaterCommand>, actor_sender: Sender<ActorMessage>, actor_mailbox: Receiver<ActorMessage>, operation_rx: Receiver<ActorOperation>, operation_tx: Sender<ActorOperation>, info_rx: Receiver<ActorInfo>, info_tx: Sender<ActorInfo>, control_rx: Receiver<ActorControl>, control_tx: Sender<ActorControl>, init: bool, parent_shutdown_receiver: ShutdownReceiver, response_tx: Sender<StartActorResult>, engine: Engine, parent_permissions: HandlerPermission, )
§Start a new actor runtime
Initializes and starts an actor runtime with the specified configuration, setting up all necessary components for the actor to run.
§Parameters
id- Unique identifier for the actorconfig- Configuration for the actor from its manifeststate_bytes- Optional initial state for the actortheater_tx- Channel for sending commands back to the Theater runtimeactor_sender- Channel for sending messages to the actoractor_mailbox- Channel for receiving messages from other actorsoperation_rx- Channel for receiving operations to performoperation_tx- Channel for sending operations to the executorinit- Whether to initialize the actor (call the init function)parent_shutdown_receiver- Receiver for shutdown signals from the parentresponse_tx- Channel for sending the start result back to the caller
This method is “start and forget” - it spawns the actor task and does not return anything.
Auto Trait Implementations§
impl Freeze for ActorRuntime
impl !RefUnwindSafe for ActorRuntime
impl Send for ActorRuntime
impl Sync for ActorRuntime
impl Unpin for ActorRuntime
impl !UnwindSafe for ActorRuntime
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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