March Docs

Registry

lib/registry.march — Registry

Named actor registry backed by Vault. Maps String names to raw actor pids (Int) so any module can look up a running actor without threading pids through the call stack.

The registry is synchronous (Vault is an in-process map) and requires no process of its own — it is initialised at module-load time.

Convention: the Application supervisor registers each child after spawning it, then sends Start() so the child can perform its own setup.

Registry.register("bastion:logger", state.logger)
Actor.cast(state.logger, Logger.Start())

Any module then looks up and sends to the actor by name:

match Registry.whereis("bastion:logger") do
None      -> ()
Some(pid) -> Actor.cast(pid, Logger.Log(Logger.Info, msg, meta))
end

Functions

fnregisterregister(name : String, pid : Int)#

Register an actor pid under a name. Overwrites any previous registration.

fnunregisterunregister(name : String)#

Remove a registration. No-op if the name was not registered.

fnwhereiswhereis(name : String) : Option(Int)#

Look up a registered actor pid by name. Returns None if not registered.