pub struct ActorDriver { /* private fields */ }Expand description
Forwards a Durable Object’s fetch and alarm entry points to the module’s
ActorHandlers.
Implementations§
Source§impl ActorDriver
impl ActorDriver
Sourcepub fn new(state: State, env: &Env, handlers: ActorHandlers) -> Self
pub fn new(state: State, env: &Env, handlers: ActorHandlers) -> Self
Builds the driver from the object’s State, its Env (for the signing
key) and the handlers the venture registered.
A deployment whose HARNESS_SECRET is missing or too short derives no
key, and every request is then refused 403 rather than served.
Sourcepub async fn fetch(&self, req: Request) -> WorkerResult<Response>
pub async fn fetch(&self, req: Request) -> WorkerResult<Response>
Handles one signed message frame.
§Errors
A worker::Error only from reading the request body; every protocol
failure is a status on the response, because the caller is a Worker that
maps statuses back to ActorErrors.
Sourcepub async fn alarm(&self) -> WorkerResult<Response>
pub async fn alarm(&self) -> WorkerResult<Response>
Runs the actor’s alarm. The actor’s kind and key come from the reserved keys a previous message committed, because an alarm carries no frame.
§Errors
When a storage read fails, and — deliberately — when the handler fails:
a failed alarm commits nothing, so workerd’s retry of a throwing alarm
handler is the retry the port’s contract promises. It is not logged
and swallowed the way RoomDriver’s tick
is, because a room tick that is missed is a tick, and an actor alarm
that is missed is a lease that never expired.