Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ logs
*.iml
rebar3.crashdump
*~
doc/
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ok
```

With 8 nodes and 4 locations at your proposal, you can get a target n-val of 8 and a location nval of 4.
That means that you can configure the system in such a way that you can loose 3 locations or 3 nodes and
That means that you can configure the system in such a way that you can lose 3 locations or 3 nodes and
still have one copy of all data available. Moreover, you have enough additional nodes to act take over the role of the lost nodes.

## Rebar3 plugin
Expand All @@ -81,3 +81,23 @@ Usage: rebar3 ring_calculator [-s <ring_size>] [-n <nodes>]
-v, --verbose print computation details
```

## Elixir

```elixir
iex> Mix.install([{:ring_calculator, [github: "OpenRiak/ring_calculator", branch: "main"]}])
iex> :ring_calculator.nvals(32, 8, 3)
........................................x
Best solution:
Target Nval 8
Location val 2
Config [4,4]
Ring: A1 B1 A2 B2 A3 B3 A4 B4 A1 B1 A2 B2 A3 B3 A4 B4 A1 B1 A2 B2 A3 B3 A4 B4 A1 B1 A2 B2 A3 B3 A4 B4 (0 violations)
:ok
```

If you would like to be able to use `ring_calculator` from a mix project you can add the following
dependency to your `mix.exs` deps.

```elixir
{:ring_calculator, github: "OpenRiak/ring_calculator", runtime: false}
```
10 changes: 9 additions & 1 deletion rebar.config
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
{erl_opts, [debug_info]}.
{deps, []}.
{deps, []}.
{plugins, [rebar3_hex, rebar3_ex_doc]}.
{hex, [{doc, #{provider => ex_doc}}]}.
{ex_doc, [
{source_url, <<"https://github.com/OpenRiak/ring_calculator">>},
{homepage_url, <<"https://github.com/OpenRiak/ring_calculator">>},
{extras, [<<"README.md">>, <<"LICENSE">>]},
{main, <<"README.md">>}
]}.
4 changes: 3 additions & 1 deletion src/ring_calculator.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@
{env, []},
{modules, []},
{licenses, ["Apache-2.0"]},
{links, []}
{links, [
{"GitHub", "https://github.com/OpenRiak/ring_calculator"}
]}
]}.