Cluster-wide name registry, mirror of Erlang's :global.
Phase C semantics (simplified)
- Single shared name table maintained at the controller level
register_name(name, pid)succeeds globally ifnameis free, returns:nootherwisewhereis_name(name)returns the pid (or:undefined)- No two-phase commit, no name conflict resolution after partition heal -- if two partitioned sides could each register the same name independently, that case isn't modeled here
- Cross-node
whereis_nameworks during partition (same shared table)
Real :global does much more (sync protocol, conflict callbacks,
atomic register-or-fail across nodes). The simplified version
covers the most common usage: one process registers a name, others
look it up. If you need split-brain semantics, build them on top
of Lockstep.Cluster.partition.
Implementation
Backed directly by a cluster-wide table inside the
Lockstep.Controller (no per-node namespacing, no auxiliary gen_server).
Names are auto-cleared when the registered pid dies.
Rewriter integration
Lockstep.Rewriter rewrites :global.{register_name, unregister_name, whereis_name, sync, send, registered_names} to
the corresponding Lockstep.Global.* calls.
Summary
Functions
Register pid under cluster-wide name. Returns :yes on
success, :no if the name is already taken or pid already owns
another name.
Names currently registered globally.
Send msg to the pid registered as name. Raises if no such name.
Mirrors :global.send/2.
Synchronize the global name table -- a no-op in this simplified
model since the single controller-side table is always consistent.
Provided for source compatibility with real :global.
Unregister name. Returns the freed name.
Return the pid registered under name, or :undefined.
Functions
Register pid under cluster-wide name. Returns :yes on
success, :no if the name is already taken or pid already owns
another name.
@spec registered_names() :: [any()]
Names currently registered globally.
Send msg to the pid registered as name. Raises if no such name.
Mirrors :global.send/2.
@spec sync() :: :ok
Synchronize the global name table -- a no-op in this simplified
model since the single controller-side table is always consistent.
Provided for source compatibility with real :global.
Unregister name. Returns the freed name.
Return the pid registered under name, or :undefined.