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§
- 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.
- 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.
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_
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.
- extract_
sidecars - Extract large blobs from serialized arguments into sidecars.
- handle_
negotiation - Handle a blob negotiation request on the server side.
- 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.