Coder Social home page Coder Social logo

mumerchem / lasp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lasp-lang/lasp

0.0 0.0 0.0 33.66 MB

Prototype implementation of Lasp in Erlang.

Home Page: http://lasp-lang.org

License: Apache License 2.0

Erlang 88.69% Makefile 0.84% Shell 8.01% HTML 0.51% JavaScript 1.87% Perl 0.01% Dockerfile 0.06%

lasp's Introduction

Lasp

Build Status

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:

1> lasp_peer_service:join('[email protected]').
ok
2> lasp_peer_service:members().
{ok,['[email protected]','[email protected]']}

Execute node b:

1> lasp_peer_service:members().
{ok,['[email protected]','[email protected]']}     

Go back to node a and run:

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:

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.

$ 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 by @marianoguerra contains concise sample code.

lasp's People

Contributors

cmeiklejohn avatar vitorenesduarte avatar ergl avatar junghunyoo avatar angbrav avatar tsloughter avatar marsleezm avatar getong avatar oubiwann avatar unbalancedparentheses avatar lasp-lang-evaluator avatar yurrriq avatar mpope9 avatar ctford avatar evanmcc avatar licenser avatar gitter-badger avatar proger avatar zeeshanlakhani avatar sztheory avatar teresy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.