What is Lasp PG?

Lasp PG is an eventually consistent, process registry for Erlang.

Lasp PG is an eventually consistent, process registry for Erlang, the spiritual successor to Riak PG. Lasp PG is similar to facilities like global and pg2, but with many of the convergence anomalies removed through the use of CRDTs. Lasp PG completely bypasses distributed Erlang, and does full replication of the groups to all nodes in the cluster.

It's based on CRDTs, and uses Lasp's underlying highly-available key-value store and membership layer ensuring high-scalability and fault-tolerance.

Building

Simple, clone it from GitHub and build!

$ git clone [email protected]:lasp-lang/lasp_pg.git
$ cd lasp_pg
$ make
$ make check

Clustering Nodes

In order to join Lasp PG to other nodes in the system, you can use the clustering API directly to specify the name of a remote node.

> lasp_peer_service:join({Name, IP, Port}).

As Lasp PG relies on our Partisan library, to retrieve your node's name, IP address, and port, you can use the myself command provided by Partisan.

> partisan_peer_service_manager:myself().
{[email protected],{127,0,0,1},51063}

Usage

What can process groups be named? They are just a term!

-type group() :: term().

To join a process to a group, just call join as you do not need to declare groups ahead of time.

lasp_pg:join(group(), pid()) -> ok.

If you want to remove a process from a group, that's also easily done with the leave command!

lasp_pg:leave(group(), pid()) -> ok.

You can also return the current members of a group, too! (Without that, where would we be! :)

lasp_pg:members(group()) -> {ok, sets:set(pid())}.