March Docs

RemoteCall

RemoteCall: the L4 remote-procedure-call safety core (P1 L4).

A remote function reference is {module, name, sig_hash, impl_hash}, stamped at compile time for a function the author has enrolled as a remote target. Node.call frames {fref, msgpack(args), reply_to, deadline} over the net-kernel; the remote runs a CAS admission check before invoking:

  • sig_hash mismatch -> Reject(TypeMismatch) — incompatible signature, a
  hard type error; never invoke.
* impl_hash mismatch -> Reject(VersionSkew)   — same type, different body;
  the peer could (P6) ship the matching body, otherwise reject.
* both match          -> Accept               — invoke the local native copy.

Failure isolation: deadline expiry, netsplit, or a remote crash come back as a CallError (DeadlineExceeded / NoConnection / RemoteExit), never a hang.

This module is the pure core: the reference, the wire protocol (MessagePack codecs for request/reply, framable inside a NetFrame), the error taxonomy, and the admission decision. The enroll/stub/registry runtime mechanism (the actual function-by-identity dispatch) and the socket transport are separate layers.

Types

typeRemoteRefRemoteRef = { module_name : String, fn_name : String, sig_hash : String, impl_hash : String }#
typeCallErrorCallError = DeadlineExceeded | NoConnection | RemoteExit(String) | TypeMismatch | VersionSkew | NoTarget#
typeVerdictVerdict = Accept | Reject(CallError)#
typeReplyResultReplyResult = Returned(List(Int)) | Failed(CallError)#
typeCallRequestCallRequest = { fref : RemoteRef, args : List(Int), reply_to : Pid, deadline : Int, correlation : Int }#
typeCallReplyCallReply = { correlation : Int, result : ReplyResult }#

Functions

fndecode_replydecode_reply(bytes : List(Int)) : Result(CallReply, String)#
fndecode_requestdecode_request(bytes : List(Int)) : Result(CallRequest, String)#
fnencode_replyencode_reply(rep : CallReply) : List(Int)#
fnencode_requestencode_request(req : CallRequest) : List(Int)#
fnerr_replyerr_reply(correlation : Int, e : CallError) : CallReply#
fnerror_messageerror_message(e : CallError) : String#
fnis_acceptis_accept(v : Verdict) : Bool#
fnok_replyok_reply(correlation : Int, payload : List(Int)) : CallReply#
fnremote_refremote_ref(module_name : String, fn_name : String, sig_hash : String, impl_hash : String) : RemoteRef#
fnrequestrequest(fref : RemoteRef, args : List(Int), reply_to : Pid, deadline : Int, correlation : Int) : CallRequest#
fnverifyverify(local_sig : String, local_impl : String, fref : RemoteRef) : Verdict#