Module local

A Local Name Registration Facility. Copyright (c) 2014, Takeru Ohta phjgt308@gmail.com

Data Types

name()

name_server_name()

otp_name()

otp_ref()

process_name()

Function Index

Function Details

name_server_child_spec/1


Equivalent to name_server_child_spec(Name, Name, 5000).

name_server_child_spec/3

Returns the child spec for a local name server that is used in embedded mode.

To embed a local name server in your application, you can simply add ChildSpec to your supervision tree.

otp_name/1


Returns OTP compatible name

register_name/2


Locally assocates the name Name with a pid Pid.

Let NameServer is element(1, Name), the registered name is limited to the name server NameServer scope.

Assumes that the name server is already started, crashes otherwise.

The function returns yes if successful, no if it failes. For example, no is returned if an attempt is made to register an already registered process or to register a process with a name that is already in use.

send/2


Sends the message Msg to the pid locally registered as Name

Failure: If Name is not a locally registered name, the calling function will exit with reason {badarg, {Name, Msg}}

start_name_server/1

Starts a name server process

The process is registered locally as ServerName using register/2.

If the process is successfully started the function returns ok.

If there already exists a process with the specified ServerName the function returnes {error, already_present}.

stop_name_server/1

Stops the name server ServerName

If successful, the function returns ok. If the name server identified by ServerName does not exist, the function returns {error, not_found}.

unregister_name/1


Removes the locally registered name Name

whereis_name/1


Returns the pid with the locally registered name Name

Returns undefined if the name is not locally registered.

which_name_servers/0


Returns a list of running name server

which_processes/1


Returns a list of registered process

which_processes/2


Returns a list of registered process that has a name which matches the pattern Pattern