Skip to content

Commit 1d341d2

Browse files
author
as
committed
Update support for Erlang 25-27, removed for 21-24.
* Removed linter, format is enough * Ran formatter again
1 parent d189779 commit 1d341d2

22 files changed

+224
-165
lines changed

.github/workflows/erlang.yml

Lines changed: 4 additions & 5 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 }}
@@ -44,7 +44,7 @@ jobs:
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,14 +53,13 @@ jobs:
5353
- uses: actions/checkout@v2
5454
- run: make format
5555
- run: make xref
56-
- run: make lint
5756
- run: make dialyzer
5857

5958
system-tests:
6059
runs-on: ubuntu-latest
6160
strategy:
6261
matrix:
63-
erlang: [ 21,22,23,24 ]
62+
erlang: [ 25,26,27 ]
6463

6564
container:
6665
image: erlang:${{ matrix.erlang }}

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

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

2424
.
2525

rebar3

-106 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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@
6363
owners :: owners_bin(),
6464
nodes :: erlang:tuple(node())}).
6565

66-
-else.
66+
- else .
67+
6768

6869
-record(chashbin,
6970
{size :: pos_integer(),

src/gen_fsm_compat.erl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -749,13 +749,13 @@ handle_msg(Msg, Parent, Name, StateName, StateData, Mod,
749749
[]);
750750
{stop, Reason, Reply, NStateData}
751751
when From =/= undefined ->
752-
{'EXIT', R} = (catch terminate(Reason,
752+
{'EXIT', R} = catch terminate(Reason,
753753
Name,
754754
Msg,
755755
Mod,
756756
StateName,
757757
NStateData,
758-
[])),
758+
[]),
759759
reply(From, Reply),
760760
exit(R);
761761
{'EXIT',
@@ -851,13 +851,13 @@ handle_msg(Msg, Parent, Name, StateName, StateData, Mod,
851851
Debug);
852852
{stop, Reason, Reply, NStateData}
853853
when From =/= undefined ->
854-
{'EXIT', R} = (catch terminate(Reason,
854+
{'EXIT', R} = catch terminate(Reason,
855855
Name,
856856
Msg,
857857
Mod,
858858
StateName,
859859
NStateData,
860-
Debug)),
860+
Debug),
861861
_ = reply(Name, From, Reply, Debug, StateName),
862862
exit(R);
863863
{'EXIT', What} ->

0 commit comments

Comments
 (0)