Skip to content

Commit 311835b

Browse files
committed
Adds support for hex, ex_doc, and Elixir
Elixir is a popular alternative on the BEAM, and by supporting those users as park of the RAIK ecosystem we can bring Riak to even more peojects. In order to generate docs run `rebar ex_doc`. This builds documentation and places it in a `doc` folder. Open `doc/index.html` to view the generated documentation. I have set up the framework so that we can publish this to hex and get more exposure.
1 parent 87b2d6b commit 311835b

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ logs
1818
*.iml
1919
rebar3.crashdump
2020
*~
21+
doc/

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ok
5454
```
5555

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

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

84+
## Elixir
85+
86+
```elixir
87+
iex> Mix.install([{:ring_calculator, [github: "OpenRiak/ring_calculator", branch: "main"]}])
88+
iex> :ring_calculator.nvals(32, 8, 3)
89+
........................................x
90+
Best solution:
91+
Target Nval 8
92+
Location val 2
93+
Config [4,4]
94+
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)
95+
:ok
96+
```
97+
98+
If you would like to be able to use `ring_calculator` from a mix project you can add the following
99+
dependency to your `mix.exs` deps.
100+
101+
```elixir
102+
{:ring_calculator, github: "OpenRiak/ring_calculator", runtime: false}
103+
```

rebar.config

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
11
{erl_opts, [debug_info]}.
2-
{deps, []}.
2+
{deps, []}.
3+
{plugins, [rebar3_hex, rebar3_ex_doc]}.
4+
{hex, [{doc, #{provider => ex_doc}}]}.
5+
{ex_doc, [
6+
{source_url, <<"https://github.com/OpenRiak/ring_calculator">>},
7+
{homepage_url, <<"https://github.com/OpenRiak/ring_calculator">>},
8+
{extras, [<<"README.md">>, <<"LICENSE">>]},
9+
{main, <<"README.md">>}
10+
]}.

src/ring_calculator.app.src

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99
{env, []},
1010
{modules, []},
1111
{licenses, ["Apache-2.0"]},
12-
{links, []}
12+
{links, [
13+
{"GitHub", "https://github.com/OpenRiak/ring_calculator"}
14+
]}
1315
]}.

0 commit comments

Comments
 (0)