Madness.Publication (Madness v0.5.0)
View SourceA handle for a service published with Madness.publish/2.
Pass it to Madness.unpublish/1 to withdraw the service. A publication is
also withdrawn automatically when its owner process exits. The owner is the
caller unless owner: was passed to Madness.publish/2.
The :pid is the lifecycle signal for failures that invalidate the
registration. It exits with {:shutdown, {:connection_lost, reason}} if its
daemon connection or Avahi entry group fails. A scoped publication exits with
{:shutdown, {:interface_lost, interface}} when its bound interface is lost
or replaced, and with {:shutdown, :interface_events_unavailable} when
interface observation loses continuity. It does not resume on a later
interface arrival; monitor the pid and publish again explicitly if desired.
This struct is a snapshot
The :name field records the name the responder accepted at publish time,
which may already differ from the name that was requested — see
"Conflicts and renaming" in Madness.publish/2.
A responder can rename a service again later, at any point in its lifetime,
when a new conflicting host appears on the network. When that happens this
struct is not updated, because it is a value you are holding, not a process.
Pass notify: true to Madness.publish/2 to receive
{:madness, ref, {:renamed, name}} messages instead.
Summary
Types
@type t() :: %Madness.Publication{ backend: module(), family: :any | :inet | :inet6, interface: :any | String.t() | pos_integer(), name: String.t(), pid: pid(), ref: reference(), service: Madness.Service.t() }
A handle for one published service.
:ref- identifies this publication, and tags the messages delivered whennotify: truewas given.:pid- the process that owns the registration. Monitor it if you want to observe the publication going away for any reason.:service- the service as requested.:name- the instance name as registered, at publish time.:interface- the interface scope the publication was created with.:family- the address family scope the publication was created with.:backend- theMadness.Responderimplementation serving it.