Skip to content

Commit

Permalink
V0.10.2 (#97)
Browse files Browse the repository at this point in the history
* Github Actions Workflow (#81)
* Added some specs and documentation to riak_core_ring (see #78)
* Fix elvis problems (#83)
* Erlang 24 support (#87)
* Fixed fresh function (#89)
* Bump v0.10.2

Co-authored-by: woelki <[email protected]>
  • Loading branch information
2 people authored and Albert Schimpf committed Mar 21, 2022
1 parent da612b5 commit 5948565
Show file tree
Hide file tree
Showing 73 changed files with 11,933 additions and 7,246 deletions.
60 changes: 43 additions & 17 deletions .github/workflows/erlang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,59 @@ name: Erlang CI

on:
push:
branches: [ develop ]
branches: [ master ]
pull_request:
branches: [ develop ]

branches: [ master ]

jobs:

build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
erlang: [ 21,22,23,24 ]

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

steps:
- uses: actions/checkout@v2
- run: make compile

test:
runs-on: ubuntu-latest
strategy:
matrix:
erlang: [ 21,22,23,24 ]

strategy:
fail-fast: false
container:
image: erlang:${{ matrix.erlang }}

steps:
- uses: actions/checkout@v2
- run: make compile
- run: make test
- run: make proper
- run: make coverage
- name: Send Coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./rebar3 as test coveralls send

verify:
runs-on: ubuntu-latest
strategy:
matrix:
otp:
- "24.2.1.0"
- "23.3.4.11"
- "22.3.4.24"
erlang: [ 21,22,23,24 ]

container:
image: erlang:${{ matrix.otp }}
image: erlang:${{ matrix.erlang }}

steps:
- uses: actions/checkout@v2
- name: Compile
run: ./rebar3 compile
- name: Run xref and dialyzer
run: ./rebar3 do xref, dialyzer
- name: Run eunit
run: ./rebar3 as gha do eunit
- uses: actions/checkout@v2
- run: make format
- run: make xref
- run: make lint
- run: make dialyzer

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ rebar3.crashdump
.rebar3/
core_vnode_eqc.log
.idea
.vscode/
*.iml
**/*.coverdata
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Build upon the essence of Riak KV's core with an up-to-date, modular and extensi
![Language](https://img.shields.io/badge/language-erlang-blue.svg)
![Release](https://img.shields.io/badge/release-R21+-9cf.svg)
![Release](https://img.shields.io/badge/formatter-erlang_otp-33d.svg)
![Build](https://img.shields.io/badge/build-rebar3%203.13.0-brightgreen.svg)
![Build](https://img.shields.io/badge/build-rebar3%203.15.1-brightgreen.svg)

[![Hex pm](https://img.shields.io/hexpm/v/riak_core_lite.svg)](https://hex.pm/packages/riak_core_lite)
[![Build Status](https://api.travis-ci.org/riak-core-lite/riak_core_lite.svg?branch=master)](https://api.travis-ci.org/riak-core-lite/riak_core_lite.svg?branch=master)
![Erlang CI](https://github.com/albsch/riak_core_lite/workflows/Erlang%20CI/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/riak-core-lite/riak_core_lite/badge.svg?branch=master)](https://coveralls.io/github/riak-core-lite/riak_core_lite?branch=master)


Expand Down
1 change: 1 addition & 0 deletions docs/Diagrams.drawio

Large diffs are not rendered by default.

98 changes: 49 additions & 49 deletions elvis.config
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
%linting and style rules
[{elvis,
[{config,
[#{dirs => ["apps/*/src", "src"],
filter => "*.erl",
rules => [{elvis_style, line_length,
#{ignore => [],
limit => 120,
skip_comments => false}},
%{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace},
{elvis_style, macro_names, #{ignore => []}},
{elvis_style, macro_module_names},
{elvis_style, operator_spaces, #{rules => [{right, ","},
{right, "++"},
{left, "++"},
{right, "--"},
{left, "--"}]}},
%{elvis_style, god_modules,
%#{limit => 40,
% ignore => []}},
{elvis_style, used_ignored_variable},
{elvis_style, no_behavior_info},
{
elvis_style,
module_naming_convention,
#{regex => "^[a-z]([a-z0-9]*_?)*(_SUITE)?$",
ignore => []}
},
{
elvis_style,
function_naming_convention,
#{regex => "^[a-z]([a-z0-9]*_?)*$"} %base: ^([a-z][a-z0-9]*_?)*$
},
{elvis_style, state_record_and_type},
{elvis_style, no_spec_with_records}
]
},
#{dirs => ["."],
filter => "Makefile",
rules => [{elvis_project, no_deps_master_erlang_mk, #{ignore => []}},
{elvis_project, protocol_for_deps_erlang_mk, #{ignore => []}}]
},
#{dirs => ["."],
filter => "rebar.config",
rules => [{elvis_project, no_deps_master_rebar, #{ignore => []}},
{elvis_project, protocol_for_deps_rebar, #{ignore => []}}]
}
]
}]
}].
[{config,
[#{dirs => ["apps/*/src", "src"], filter => "*.erl",
rules =>
[{elvis_text_style,
line_length,
#{limit => 120, skip_comments => false}},
%{elvis_text_style, no_tabs},
{elvis_text_style, no_trailing_whitespace},
{elvis_style, macro_names, #{ignore => []}},
{elvis_style, macro_module_names},
{elvis_style,
operator_spaces,
#{rules =>
[{right, ","},
{right, "++"},
{left, "++"},
{right, "--"},
{left, "--"}]}},
%{elvis_style, god_modules,
%#{limit => 40,
% ignore => []}},
{elvis_style, used_ignored_variable},
{elvis_style, no_behavior_info},
{elvis_style,
module_naming_convention,
#{regex => "^[a-z]([a-z0-9]*_?)*(_SUITE)?$",
ignore => []}},
{elvis_style,
function_naming_convention,
#{regex => "^[a-z]([a-z0-9]*_?)*$"}},
%TODO add state() type
%{elvis_style, state_record_and_type},
{elvis_style, no_spec_with_records}]},
#{dirs => ["."], filter => "Makefile",
rules =>
[{elvis_project,
no_deps_master_erlang_mk,
#{ignore => []}},
{elvis_project,
protocol_for_deps_erlang_mk,
#{ignore => []}}]},
#{dirs => ["."], filter => "rebar.config",
rules =>
[{elvis_project, no_deps_master_rebar, #{ignore => []}},
{elvis_project,
protocol_for_deps_rebar,
#{ignore => []}}]}]}]}]

.
64 changes: 38 additions & 26 deletions include/riak_core_handoff.hrl
Original file line number Diff line number Diff line change
@@ -1,50 +1,62 @@
-type riak_core_handoff_dict() :: dict:dict().

-define(PT_MSG_INIT, 0).

-define(PT_MSG_OBJ, 1).

-define(PT_MSG_OLDSYNC, 2).

-define(PT_MSG_SYNC, 3).

-define(PT_MSG_CONFIGURE, 4).

-define(PT_MSG_BATCH, 5).

-define(PT_MSG_VERIFY_NODE, 6).

-define(PT_MSG_UNKNOWN, 255).

-record(ho_stats,
{
interval_end :: erlang:timestamp(),
last_update :: erlang:timestamp() | undefined,
objs=0 :: non_neg_integer(),
bytes=0 :: non_neg_integer()
}).
{interval_end :: erlang:timestamp(),
last_update :: erlang:timestamp() | undefined,
objs = 0 :: non_neg_integer(),
bytes = 0 :: non_neg_integer()}).

-type ho_stats() :: #ho_stats{}.

-type ho_type() :: ownership | hinted | repair | resize.

-type predicate() :: fun((any()) -> boolean()).

-type index() :: chash:index_as_int().
-type mod_src_tgt() :: {module(), index(), index()} | {undefined, undefined, undefined}.

-type mod_src_tgt() :: {module(), index(), index()} |
{undefined, undefined, undefined}.

-type mod_partition() :: {module(), index()}.

-record(handoff_status,
{ mod_src_tgt :: mod_src_tgt(),
src_node :: node(),
target_node :: node(),
direction :: inbound | outbound,
transport_pid :: pid(),
transport_mon :: reference(),
timestamp :: tuple(),
status :: any(),
stats :: riak_core_handoff_dict(),
vnode_pid :: pid() | undefined,
vnode_mon :: reference() | undefined,
type :: ho_type() | undefined,
req_origin :: node(),
filter_mod_fun :: {module(), atom()} | undefined,
size :: {function(), dynamic} | {non_neg_integer(), bytes | objects} | undefined
}).
{mod_src_tgt :: mod_src_tgt(),
src_node :: node(),
target_node :: node(),
direction :: inbound | outbound,
transport_pid :: pid(),
transport_mon :: reference(),
timestamp :: tuple(),
status :: any(),
stats :: riak_core_handoff_dict(),
vnode_pid :: pid() | undefined,
vnode_mon :: reference() | undefined,
type :: ho_type() | undefined,
req_origin :: node(),
filter_mod_fun :: {module(), atom()} | undefined,
size ::
{function(), dynamic} |
{non_neg_integer(), bytes | objects} |
undefined}).

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

-type known_handoff() :: {{module(), index()},
{ho_type()|'delete',
'inbound'|'outbound'|'local',
node()|'$resize'|'$delete'}}.
{ho_type() | delete, inbound | outbound | local,
node() | '$resize' | '$delete'}}.
73 changes: 43 additions & 30 deletions include/riak_core_vnode.hrl
Original file line number Diff line number Diff line change
@@ -1,50 +1,63 @@
-type sender_type() :: fsm | server | raw.
-type sender() :: {sender_type(), reference() | tuple(), pid()} |
%% TODO: Double-check that these special cases are kosher
{fsm, undefined, pid()} | % what are these special cases and what is the reference used for??
{server, undefined, undefined} | % special case in riak_core_vnode_master.erl

-type sender() :: {sender_type(), reference() | tuple(),
pid()} |
{fsm, undefined, pid()} |
{server, undefined, undefined} |
ignore.

%% TODO: Double-check that these special cases are kosher

% what are these special cases and what is the reference used for??

% special case in riak_core_vnode_master.erl

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

-type vnode_req() :: term().

-type keyspaces() :: [{partition(), [partition()]}].

-record(riak_vnode_req_v1, {
index :: partition() | undefined,
sender=ignore :: sender(),
request :: vnode_req()}).

-record(riak_coverage_req_v1, {
index :: partition(),
keyspaces :: keyspaces(),
sender=ignore :: sender(),
request :: vnode_req()}).

-record(riak_core_fold_req_v1, {
foldfun :: fun(),
acc0 :: term()}).
-record(riak_core_fold_req_v2, {
foldfun :: fun(),
acc0 :: term(),
forwardable :: boolean(),
opts = [] :: list()}).
-record(riak_vnode_req_v1,
{index :: partition() | undefined,
sender = ignore :: sender(),
request :: vnode_req()}).

-record(riak_coverage_req_v1,
{index :: partition(),
keyspaces :: keyspaces(),
sender = ignore :: sender(),
request :: vnode_req()}).

-record(riak_core_fold_req_v1,
{foldfun :: fun(), acc0 :: term()}).

-record(riak_core_fold_req_v2,
{foldfun :: fun(),
acc0 :: term(),
forwardable :: boolean(),
opts = [] :: list()}).

-define(KV_VNODE_LOCK(Idx), {vnode_lock, Idx}).

-type handoff_dest() :: {riak_core_handoff_manager:ho_type(), {partition(), node()}}.
-type
handoff_dest() :: {riak_core_handoff_manager:ho_type(),
{partition(), node()}}.

%% An integer, and the number of bits to shift it left to treat it as
%% a mask in the 2^160 key space
%%
%% For a more thorough explanation of how these structures are used,
%% see `riak_core_coverage_plan'.
-type subpartition() :: { non_neg_integer(), pos_integer() }.
-type subpartition() :: {non_neg_integer(),
pos_integer()}.

-record(vnode_coverage, {
vnode_identifier = 0 :: non_neg_integer(),
partition_filters = [] :: [non_neg_integer()],
subpartition = undefined :: undefined | subpartition()
}).
-record(vnode_coverage,
{vnode_identifier = 0 :: non_neg_integer(),
partition_filters = [] :: [non_neg_integer()],
subpartition = undefined ::
undefined | subpartition()}).

-type vnode_selector() :: all | allup.

-type vnode_coverage() :: #vnode_coverage{}.
Loading

0 comments on commit 5948565

Please sign in to comment.