Skip to content

Commit 83c3e75

Browse files
albschas
andauthored
Update support for Erlang 25-27, removed for 21-24. (#113)
* Removed rebar3 binary * Removed linter, format is enough * Ran formatter again * Fixed typo * Some types are not valid anymore (e.g. tuple(node())), some types not exported (init:internal_status). Fixed and added TODOs * Ignored a function for dialyzer, reason unknown why dialyzer complains * Fixed typo * Removed elvis config Co-authored-by: as <git@schimpf.link>
1 parent d189779 commit 83c3e75

25 files changed

+236
-251
lines changed

.github/workflows/erlang.yml

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
erlang: [ 21,22,23,24 ]
14+
erlang: [ 25,26,27 ]
1515

1616
container:
1717
image: erlang:${{ matrix.erlang }}
@@ -24,7 +24,7 @@ jobs:
2424
runs-on: ubuntu-latest
2525
strategy:
2626
matrix:
27-
erlang: [ 21,22,23,24 ]
27+
erlang: [ 25,26,27 ]
2828

2929
container:
3030
image: erlang:${{ matrix.erlang }}
@@ -38,13 +38,13 @@ jobs:
3838
- name: Send Coverage
3939
env:
4040
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
run: ./rebar3 as test coveralls send
41+
run: rebar3 as test coveralls send
4242

4343
verify:
4444
runs-on: ubuntu-latest
4545
strategy:
4646
matrix:
47-
erlang: [ 21,22,23,24 ]
47+
erlang: [ 25,26,27 ]
4848

4949
container:
5050
image: erlang:${{ matrix.erlang }}
@@ -53,31 +53,5 @@ jobs:
5353
- uses: actions/checkout@v2
5454
- run: make format
5555
- run: make xref
56-
- run: make lint
5756
- run: make dialyzer
5857

59-
system-tests:
60-
runs-on: ubuntu-latest
61-
strategy:
62-
matrix:
63-
erlang: [ 21,22,23,24 ]
64-
65-
container:
66-
image: erlang:${{ matrix.erlang }}
67-
68-
steps:
69-
- uses: actions/checkout@v2
70-
with:
71-
repository: riak-core-lite/rclref
72-
path: ./rclref
73-
74-
- uses: actions/checkout@v2
75-
with:
76-
path: ./riak_core/
77-
78-
- run: |
79-
mkdir rclref/_checkouts;\
80-
ln -s ../../riak_core/ rclref/_checkouts/riak_core;\
81-
cd rclref;\
82-
make ct
83-

Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PULSE_TESTS = worker_pool_pulse
22
COVERPATH = ./_build/test/cover
3-
REBAR ?= ./rebar3
3+
REBAR ?= rebar3
44

55
.PHONY: deps test docs xref dialyzer format
66

@@ -57,5 +57,3 @@ xref: compile
5757
dialyzer:
5858
${REBAR} dialyzer
5959

60-
lint:
61-
${REBAR} lint

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Build upon the essence of Riak KV's core with an up-to-date, modular and extensi
77
# riak_core_lite
88

99
![Language](https://img.shields.io/badge/language-erlang-blue.svg)
10-
![Release](https://img.shields.io/badge/release-R21+-9cf.svg)
10+
![Release](https://img.shields.io/badge/release-R25+-9cf.svg)
1111
![Release](https://img.shields.io/badge/formatter-erlang_otp-33d.svg)
1212
![Build](https://img.shields.io/badge/build-rebar3%203.15.1-brightgreen.svg)
1313

elvis.config

Lines changed: 0 additions & 51 deletions
This file was deleted.

include/riak_core_handoff.hrl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,9 @@
5050
type :: ho_type() | undefined,
5151
req_origin :: node(),
5252
filter_mod_fun :: {module(), atom()} | undefined,
53-
size = {0, objects}::
53+
size = {0, objects} ::
5454
{function(), dynamic} |
55-
{non_neg_integer(), bytes | objects}
56-
}).
55+
{non_neg_integer(), bytes | objects}}).
5756

5857
-type handoff_status() :: #handoff_status{}.
5958

include/riak_core_vnode.hrl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
-type sender_type() :: fsm | server .
1+
-type sender_type() :: fsm | server.
22

3-
-type sender() :: {sender_type(), reference() | tuple() | ignore_ref , pid()} | ignore.
3+
-type sender() :: {sender_type(),
4+
reference() | tuple() | ignore_ref, pid()} |
5+
ignore.
46

57
-type partition() :: chash:index_as_int().
68

rebar.config

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
.
1919

2020
%% Code formatter
21-
{project_plugins,
22-
[rebar3_format, rebar3_lint, rebar3_proper]}
21+
{project_plugins, [rebar3_format, rebar3_proper]}
2322

2423
.
2524

rebar3

-929 KB
Binary file not shown.

src/chash.erl

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,19 @@ fresh(NumPartitions, SeedNode) ->
103103
Inc = ring_increment(NumPartitions),
104104
{NumPartitions,
105105
[{IndexAsInt, SeedNode}
106-
|| IndexAsInt <- lists:seq(0, (?RINGTOP) -1 -(?RINGTOP rem NumPartitions), Inc)]}.
106+
|| IndexAsInt
107+
<- lists:seq(0,
108+
(?RINGTOP) - 1 - (?RINGTOP) rem NumPartitions,
109+
Inc)]}.
107110

108111
%% @doc Find the Node that owns the partition identified by IndexAsInt.
109112
-spec lookup(IndexAsInt :: index_as_int(),
110113
CHash :: chash()) -> chash_node().
111114

112115
lookup(IndexAsInt, CHash) ->
113116
{_NumPartitions, NodeEntries} = CHash,
114-
{IndexAsInt, Node} = proplists:lookup(IndexAsInt, NodeEntries),
117+
{IndexAsInt, Node} = proplists:lookup(IndexAsInt,
118+
NodeEntries),
115119
Node.
116120

117121
sha(Bin) -> crypto:hash(sha, Bin).
@@ -141,7 +145,8 @@ merge_rings(CHashA, CHashB) ->
141145
{NumPartitions, NodeEntriesB} = CHashB,
142146
{NumPartitions,
143147
[{I, random_node(NodeA, NodeB)}
144-
|| {{I, NodeA}, {I, NodeB}} <- lists:zip(NodeEntriesA, NodeEntriesB)]}.
148+
|| {{I, NodeA}, {I, NodeB}}
149+
<- lists:zip(NodeEntriesA, NodeEntriesB)]}.
145150

146151
%% @doc Given the integer representation of a chash key,
147152
%% return the next ring index integer value.
@@ -166,7 +171,10 @@ nodes(CHash) ->
166171
ordered_from(Index, {NumPartitions, NodeEntries}) ->
167172
<<IndexAsInt:160/integer>> = Index,
168173
Inc = ring_increment(NumPartitions),
169-
{NodeEntriesA, NodeEntriesB} = lists:split(IndexAsInt div Inc + 1, NodeEntries),
174+
{NodeEntriesA, NodeEntriesB} = lists:split(IndexAsInt
175+
div Inc
176+
+ 1,
177+
NodeEntries),
170178
NodeEntriesB ++ NodeEntriesA.
171179

172180
%% @doc Given an object key, return all NodeEntries in reverse order
@@ -236,9 +244,9 @@ successors(Index, CHash, N) ->
236244
update(IndexAsInt, Name, CHash) ->
237245
{NumPartitions, NodeEntries} = CHash,
238246
NewNodeEntries = lists:keyreplace(IndexAsInt,
239-
1,
240-
NodeEntries,
241-
{IndexAsInt, Name}),
247+
1,
248+
NodeEntries,
249+
{IndexAsInt, Name}),
242250
{NumPartitions, NewNodeEntries}.
243251

244252
%% ====================================================================
@@ -268,9 +276,12 @@ random_node(NodeA, NodeB) ->
268276
-ifdef(TEST).
269277

270278
fresh_sizes_test() ->
271-
lists:foreach(fun(I) ->
272-
?assertEqual(I, (length(chash:nodes(chash:fresh(I, the_node)))))
273-
end, [1, 10000]).
279+
lists:foreach(fun (I) ->
280+
?assertEqual(I,
281+
(length(chash:nodes(chash:fresh(I,
282+
the_node)))))
283+
end,
284+
[1, 10000]).
274285

275286
update_test() ->
276287
Node = old@host,
@@ -281,14 +292,13 @@ update_test() ->
281292
{Index, _} = lists:nth(N, NodeEntries),
282293
Index
283294
end,
284-
285295
{5,
286296
[{_, Node},
287297
{_, Node},
288298
{_, Node},
289299
{_, Node},
290-
{_, Node}]} = CHash,
291-
300+
{_, Node}]} =
301+
CHash,
292302
% Test update...
293303
FirstIndex = GetNthIndex(1, CHash),
294304
ThirdIndex = GetNthIndex(3, CHash),

src/chashbin.erl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,16 @@
6161
-record(chashbin,
6262
{size :: pos_integer(),
6363
owners :: owners_bin(),
64-
nodes :: erlang:tuple(node())}).
64+
nodes ::
65+
tuple()}). % tuples as arrays, was tuple(node()) before
66+
67+
- else .
6568

66-
-else.
6769

6870
-record(chashbin,
6971
{size :: pos_integer(),
7072
owners :: owners_bin(),
71-
nodes :: erlang:tuple(node())}).
73+
nodes :: tuple()}).
7274

7375
-endif.
7476

0 commit comments

Comments
 (0)