This is a question regarding the implementation of custom process registries.
While my actual registry is going to be in an Elixir module, to provide part of a ‘Persistent GenServer’ implementation (starting up processes that are currently ‘off’ but persisted on disk when asked for them), the question itself is more related to via-tuples and the process registry behaviour as defined by Erlang.
(See for instance the Erlang documentation of
So in this paragraph, the registry ‘behaviour’ (in a loose, implicit sense) is defined as "you need to implement these four functions to work the same as in
My question, then, is about when these various functions are being called: When you pass a via-tuple to a function that sends a message, does the runtime system (or OTP):
your_registry_module:whereis_name/1and then use the returned PID to send directly?
And is there a difference between these depending on when we use
gen_server:call/cast vs the raw sending of messages? Why do both of these functions exist, since one of them can be implemented with the other?