Pg2 v1.0.0 Pg2
A slightly opinionated wrapper around :pg2. Pg2 adds conveniences like
automatic group creation in join, and returns empty lists when querying
membership of non-existant groups. See the documenation for each method for
specific differences from :pg2
Link to this section Summary
Functions
Creates a new, empty process group. The group is globally visible on all nodes. If the group exists, nothing happens
Deletes a process group
A useful dispatch function that can be used from client functions. It returns a process on the local node, if such a process exists. Otherwise, it selects one randomly
Returns all processes running on the local node in the group Name. This function is to be used from within a client function that accesses the group. It is therefore optimized for speed
Returns all processes in the group Name. This function is to be used from within a client function that accesses the group. It is therefore optimized for speed
Joins the process pid to the group group_name. A process can join a group
many times and must then leave the group the same number of times
Makes the process pid leave the group Name. If the process is not a
member of the group, ok is returned
Starts the pg2 server. Normally, the server does not need to be started explicitly, as it is started dynamically if it is needed. This is useful during development, but in a target system the server is to be started explicitly. Use the configuration parameters for kernel(6) for this
Starts the pg2 server. Normally, the server does not need to be started explicitly, as it is started dynamically if it is needed. This is useful during development, but in a target system the server is to be started explicitly. Use the configuration parameters for kernel(6) for this
Returns a list of all known groups
Link to this section Types
Link to this section Functions
Creates a new, empty process group. The group is globally visible on all nodes. If the group exists, nothing happens.
Deletes a process group.
get_closest_pid(group_name) :: :ok | {:no_process, group_name}
A useful dispatch function that can be used from client functions. It returns a process on the local node, if such a process exists. Otherwise, it selects one randomly.
Differences from :pg2
- this function returns
{:no_process, group_name}if the group does not exist, rather than{:no_such_group, group_name}
Returns all processes running on the local node in the group Name. This function is to be used from within a client function that accesses the group. It is therefore optimized for speed.
Differences from :pg2
- this function returns an empty list if the group does not exist.
Returns all processes in the group Name. This function is to be used from within a client function that accesses the group. It is therefore optimized for speed.
Differences from :pg2
- this function returns an empty list if the group does not exist.
Joins the process pid to the group group_name. A process can join a group
many times and must then leave the group the same number of times.
Differences from :pg2
- this function defaults the pid to
self() - this function creates the group if it does not exist
Makes the process pid leave the group Name. If the process is not a
member of the group, ok is returned.
Differences from :pg2
- defaults the pid to
self() - returns
:okif the group does not exist - deletes the group if it is empty
Starts the pg2 server. Normally, the server does not need to be started explicitly, as it is started dynamically if it is needed. This is useful during development, but in a target system the server is to be started explicitly. Use the configuration parameters for kernel(6) for this.
Starts the pg2 server. Normally, the server does not need to be started explicitly, as it is started dynamically if it is needed. This is useful during development, but in a target system the server is to be started explicitly. Use the configuration parameters for kernel(6) for this.
Returns a list of all known groups.