Skip to content

prehnRA/maelstrom_ex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maelstrom

Allows you to create servers which implement the Maelstrom protocol.

Maelstrom is a workbench for learning distributed systems by writing your own.

Links

Usage

To implement a server:

  1. Create a module and use Maelstrom
  2. Implement one or more handle_message heads.
  3. Call MyModule.run_forever().

I recommend you do this in a .exs script. Example:

defmodule Echo do
use Maelstrom

def handle_message(_src, _dest, %{"echo" => echo}, state, _) do
  {:reply, %{"type" => "echo_ok", "echo" => echo}, state}
end
end

Echo.run_forever()

You could then run this with mix run e.g. mix run echo.exs.

Tip {: .tip}

Maelstrom expects a single binary with no arguments to call for testing. In order to accomplish this, wrap your mix run command in a shell script (see demos for examples).

Examples

For more examples, see demos.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages