Expand description
Per-function remote execution support
This module provides the types and executor for transferring function
execution to another machine. The design sends the full compiled
BytecodeProgram + a “call this function with these args” message,
running it on a full Shape VM on the remote side.
§Architecture
Layer 4: @remote / @distributed annotations (Shape stdlib — user-defined policy)
Layer 3: RemoteCallRequest/Response (this module)
Layer 2: shape-wire codec (MessagePack) (encode_message / decode_message)
Layer 1: Transport (TCP/QUIC/Unix socket) (user-provided, pluggable)Layer 0 (the foundation): Full Shape VM on both sides, same BytecodeProgram,
same Executor.
§Closure semantics
Arc<RwLock<ValueWord>> upvalues become value copies on serialization.
If the remote side mutates a captured variable, the sender doesn’t see it.
This is the correct semantic for distributed computing — a send-copy model.
Structs§
- Auth
Request - Authentication request for non-localhost connections.
- Auth
Response - Authentication response.
- Blob
Negotiation Request - Request to check which function blobs the remote side already has cached.
- Blob
Negotiation Response - Response indicating which offered blobs are already cached on the remote side.
- Blob
Sidecar - A large binary payload sent as a separate message before the call request.
- Execute
File Request - Request to execute a Shape file on the server.
- Execute
Project Request - Request to execute a Shape project (shape.toml) on the server.
- Execute
Request - Request to execute Shape source code on the server.
- Execute
Response - Response from executing Shape source code.
- Execution
Metrics - Execution performance metrics.
- Ping
Request - Ping request (empty payload for wire format consistency).
- Remote
Blob Cache - Per-connection cache of function blobs received from a remote peer.
- Remote
Call Error - Error from remote execution.
- Remote
Call Request - Request to execute a function on a remote VM.
- Remote
Call Response - Response from a remote function execution.
- Server
Info - Server information returned in Pong responses.
- Validate
Path Request - Request to validate a Shape file or project without executing.
- Validate
Request - Request to validate Shape source code without executing it.
- Validate
Response - Response from validating Shape source code.
- Wire
Diagnostic - A diagnostic message (error, warning, info).
Enums§
- Remote
Error Kind - Classification of remote execution errors.
- Wire
Message - Envelope for all wire protocol messages.
Constants§
- SIDECAR_
THRESHOLD - Minimum blob size (in bytes) to extract as a sidecar. Blobs smaller than this are left inline in the serialized payload.
Functions§
- build_
call_ request - Build a
RemoteCallRequestfor a named function. - build_
call_ request_ negotiated - Build a
RemoteCallRequestthat strips function blobs the remote already has. - build_
call_ request_ with_ negotiation - Build a
RemoteCallRequestfor a named function, with blob negotiation. - build_
closure_ call_ request - Build a
RemoteCallRequestfor a closure. - build_
minimal_ blobs - Backwards-compatible name-based wrapper around
build_minimal_blobs_by_hash. - build_
minimal_ blobs_ by_ hash - Build a minimal set of function blobs for a function hash and its
transitive dependencies from a content-addressed
Program. - execute_
remote_ call - Execute a remote call request on this machine.
- execute_
remote_ call_ with_ runtimes - Execute a remote call with pre-loaded language runtime extensions.
- extract_
sidecars - Extract large blobs from serialized arguments into sidecars.
- handle_
negotiation - Handle a blob negotiation request on the server side.
- handle_
wire_ message - Handle a
WireMessageby dispatching to the appropriate handler. - negotiate_
blobs - Perform blob negotiation before sending a call request.
- program_
from_ blobs - Backwards-compatible name-based wrapper around
program_from_blobs_by_hash. - program_
from_ blobs_ by_ hash - Build a minimal
Programfrom function blobs and an explicit entry hash. - program_
hash - Compute a SHA-256 hash of a
BytecodeProgramfor caching. - reassemble_
sidecars - Reassemble sidecars back into the serialized payload.