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.
- Endpoint
Metrics - One endpoint’s counters.
- Handler
- The worker side of an invocation, for any HTTP framework: give it the
request’s
fusee-signatureheader and body, answer with itsReply. Each call opens a fresh engine and closes it before it returns; nothing is kept between invocations. - Invoke
Metrics - The invoker’s counters (
Server::invocation_metrics). - Reply
- What a
Handleranswers: 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
handlerover HTTP onlisteneruntil the task is cancelled: a self-hosted endpoint. Withtls, over HTTPS; a CA intlsrequires the server’s client certificate (mutual TLS). - serve_
with - Like
serve, answering eachPOSTwithanswer(signature header, body): for a process that hands invocations on (to a child process, a queue) instead of running them itself. - sign
- The
fusee-signaturevalue forbodysigned att_ms(Unix ms):t=<t_ms>,v1=<hex HMAC-SHA256(secret, "<t_ms>." + body)>. - verify
- Checks a
fusee-signaturevalue againstbodyatnow_ms: the MAC (in constant time) and the timestamp, withinSIGNATURE_TOLERANCE. - with_
invocation addresswithinvocation=<id>among its options.