Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lasp-lang/lasp
Prototype implementation of Lasp in Erlang.
https://github.com/lasp-lang/lasp
crdt distributed-systems erlang lasp
Last synced: about 1 month ago
JSON representation
Prototype implementation of Lasp in Erlang.
- Host: GitHub
- URL: https://github.com/lasp-lang/lasp
- Owner: lasp-lang
- License: apache-2.0
- Archived: true
- Created: 2014-06-10T11:12:41.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2021-03-02T15:30:15.000Z (over 3 years ago)
- Last Synced: 2024-09-25T21:50:08.870Z (about 1 month ago)
- Topics: crdt, distributed-systems, erlang, lasp
- Language: Erlang
- Homepage: http://lasp-lang.org
- Size: 32.9 MB
- Stars: 892
- Watchers: 52
- Forks: 71
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-starred - lasp-lang/lasp - Prototype implementation of Lasp in Erlang. (others)
README
Lasp
=======================================================[![Build Status](https://travis-ci.org/lasp-lang/lasp.svg?branch=master)](https://travis-ci.org/lasp-lang/lasp)
## Overview
Lasp is a programming model for synchronization-free computations.
## Installing
Lasp requires Erlang 19 or greater. Once you have Erlang installed, do
the following to install and build Lasp.```
$ git clone [email protected]:lasp-lang/lasp.git
$ cd lasp
$ make
```## Creating a small cluster
Clone Lasp:
```
$ git clone https://github.com/lasp-lang/lasp.git
```Run two shells
```
$ rebar3 shell --name [email protected]
$ rebar3 shell --name [email protected]
```Exceute to node a:
```erlang
1> lasp_peer_service:join('[email protected]').
ok
2> lasp_peer_service:members().
{ok,['[email protected]','[email protected]']}
```Execute node b:
```erlang
1> lasp_peer_service:members().
{ok,['[email protected]','[email protected]']}
```Go back to node a and run:
```erlang
3> Content = #{what => i_am_an_awmap_value}.% create a lasp CRDT
AwMapVarName = <<"awmap">>.
Key1 = <<"key1">>.
AwMapType = {state_awmap, [state_mvregister]}.
{ok, {AwMap, _, _, _}} = lasp:declare({AwMapVarName, AwMapType}, AwMapType).% Update the CRDT with the content
{ok, _} = lasp:update(AwMap, {apply, Key1, {set, nil, Content}}, term_to_binary(self())).
```Go to node b and retrieve the content of the CRDT:
```erlang
2> {ok,[{_, AwMapSet}]} = lasp:query({<<"awmap">>,{state_awmap,[state_mvregister]}}).3> sets:to_list(AwMapSet).
% [#{what => i_am_an_awmap_value}]
```## Running a shell
You can run a Erlang shell where you can interact with a Lasp node by
doing the following:```
$ make shell
```## Running the test suite
To run the test suite, which will execute all of the Lasp scenarios, use
the following command.```bash
$ make check
```## Notes
If using the Distributed Erlang backend, make sure that all nodes are configured to use the same cookie.
## Code examples
[This blog post](http://marianoguerra.org/posts/playing-with-lasp-and-crdts.html) by [@marianoguerra](https://github.com/marianoguerra) contains concise sample code.