Skip to main content

Module invoke

Module invoke 

Expand description

Workers invoked over HTTP: suspend to zero.

A server configured with Endpoints (Server::set_invokers) sends an HTTP POST to one when a shard that no worker holds has work due (a client call, a message from another shard, a timer, or a holder that left without saying what was next). The process that receives it (a function on Lambda, Cloud Run or Vercel, or any HTTP server) hands the request to a Handler, which connects to the server as a worker for exactly that invocation’s shards, runs them until they are idle or the invocation’s budget ends, reports each shard’s next due time and returns. The server invokes again when more work comes; nothing stays up while workflows sleep. Leases, epochs and fencing are those of every worker, so exactly-once effects are unchanged. See docs/server-mode.md.

Structs§

Endpoint
An HTTP endpoint the server invokes workers at.
EndpointMetrics
One endpoint’s counters.
Handler
The worker side of an invocation, for any HTTP framework: give it the request’s fusee-signature header and body, answer with its Reply. Each call opens a fresh engine and closes it before it returns; nothing is kept between invocations.
InvokeMetrics
The invoker’s counters (Server::invocation_metrics).
Reply
What a Handler answers: an HTTP status and a JSON body.
Request
The body of an invocation request.
Secret
A secret whose bytes are never printed.

Enums§

Progress
Where an invoked worker’s invocation stands (Remote::invocation_poll).

Constants§

PARK_AFTER
How long a suspended run stays loaded in an invoked worker before it is parked (written to the run store). Short: the worker leaves soon, and a parked run costs the next invocation’s open almost nothing.
SIGNATURE_HEADER
The header that carries the request’s signature.
SIGNATURE_TOLERANCE
How old a signature a handler accepts.

Functions§

format_id
An invocation ID as the request and the invocation= option carry it: 16 lowercase hex digits.
parse_id
Parses format_id’s output.
serve
Serves handler over HTTP on listener until the task is cancelled: a self-hosted endpoint. With tls, over HTTPS; a CA in tls requires the server’s client certificate (mutual TLS).
serve_with
Like serve, answering each POST with answer(signature header, body): for a process that hands invocations on (to a child process, a queue) instead of running them itself.
sign
The fusee-signature value for body signed at t_ms (Unix ms): t=<t_ms>,v1=<hex HMAC-SHA256(secret, "<t_ms>." + body)>.
verify
Checks a fusee-signature value against body at now_ms: the MAC (in constant time) and the timestamp, within SIGNATURE_TOLERANCE.
with_invocation
address with invocation=<id> among its options.