ostinelli / syn

A scalable global Process Registry and Process Group manager for Erlang and Elixir.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support registering metadata in via-tuples

ahovgaard opened this issue · comments

I would like to suggest extending the via-tuple support to allow registering metadata as well. This would enable one to do as follows:

iex> tuple = {:via, :syn, {:devices, "SN-123-456789", [meta: :one]}}
{:via, :syn, {:devices, "SN-123-456789", [meta: :one]}}
iex> GenServer.start_link(__MODULE__, [], name: tuple)
{ok, #PID<0.105.0>}
iex> :syn.lookup(:devices, "SN-123-456789")
{#PID<0.105.0>, [meta: :one]}

For reference, registering a value in a via-tuple is already supported by the Elixir Registry, see: https://hexdocs.pm/elixir/1.12/Registry.html#module-using-in-via

If this feature is considered appropriate and useful, I would like to implement it and make a PR with the changes.

Sounds good! I'd be happy to review & merge in.

This is now in 3.2.1.