GlobalPid
GlobalPid: a serializable, cluster-wide process handle (P1 L4 prerequisite).
Location-transparent send/cast/call need a process identity that survives the wire. A global Pid is {NodeId, local_pid, creation}: the owning node, the node-local scheduler pid (the runtime's integer PID), and a creation counter that distinguishes a restarted node's reused local pids from the originals (so a stale Pid from before a restart is detectably stale). It round-trips through MessagePack to ride inside a NetFrame.
Types
Functions
Decode bytes produced by encode. Returns Err for invalid MessagePack (the decoder's message) or a malformed pid.
The pid's MessagePack wire bytes (Msgpack.encode(to_value(p))).
Examples
GlobalPid.decode(GlobalPid.encode(GlobalPid.make("n1", 7, 1)))
-- Ok(GlobalPid.make("n1", 7, 1))Whether [a] and [b] name the same process: same node, same local pid AND same creation, so a pid from before a node restart never equals one from after it.
Examples
march> GlobalPid.eq(GlobalPid.make("n1", 7, 1), GlobalPid.make("n1", 7, 1))
true
march> GlobalPid.eq(GlobalPid.make("n1", 7, 1), GlobalPid.make("n1", 7, 2))
falseA global pid for local pid [local_pid] on node [node_id] in that node's [creation].
Examples
march> let gp = GlobalPid.make("n1", 7, 2)
march> gp.local_pid
7
march> let gp = GlobalPid.make("n1", 7, 2)
march> gp.node_id
"n1"Read a pid back from a MessagePack value produced by to_value. Returns Err("GlobalPid: malformed pid") for anything that is not exactly a 3-element array of (Str, Int, Int).