Skip to content

Commit

Permalink
Ignore VSCode sttings
Browse files Browse the repository at this point in the history
Added specs and documentation to riak_core_claim
+ format

Added some specs and documentation to riak_core_ring (see #78)

Added specs and documentation to riak_core_apl

Added tags to chashbin documentation

Added specs and documentation to riak_core_apl
fixed typo in doc tag in chashbin

Added documentation status: done to reviewed files

Added specs and documentation to riak_core_app

Added documentation status: done to riak_core_app

Added specs and documentation to riak_core

Added specs and documentation to riak_core_claimant

Fixed typo in atom in spec

Added some specs and documentation to riak_core_ring_manager while

Added documentation to riak_core_handoff_listener_sup

Added specs to all handoff supervisors

Added documentation to riak_core_handoff_listener

Added documentation to riak_core_handoff_manager

Documentation for riak_core_handoff_receiver

Added documentation to riak_core_handoff_sender

Added draw.io project cotaining action diagrams of some core functionalities.

Apply suggestions from code review

Removed status of documentation from source files
  • Loading branch information
Pascal Grosch authored and Albert Schimpf committed Jul 13, 2021
1 parent 430aa72 commit 7559873
Show file tree
Hide file tree
Showing 21 changed files with 2,003 additions and 127 deletions.
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
1 change: 1 addition & 0 deletions docs/Diagrams.drawio

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/chash.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

-module(chash).


-export([contains_name/2, fresh/2, lookup/2, key_of/1,
members/1, merge_rings/2, next_index/2, nodes/1,
predecessors/2, predecessors/3, ring_increment/1,
Expand Down
27 changes: 18 additions & 9 deletions src/chashbin.erl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
%% -------------------------------------------------------------------
-module(chashbin).


-export([create/1, to_chash/1, to_list/1,
to_list_filter/2, responsible_index/2,
responsible_position/2, index_owner/2,
Expand Down Expand Up @@ -164,6 +165,16 @@ iterator(HashKey, CHBin) ->
Pos = responsible_position(HashKey, CHBin),
#iterator{pos = Pos, start = Pos, chbin = CHBin}.

%% @doc Return iterator pointing to the given index
-spec exact_iterator(Index :: index() | <<_:160>>,
CHBin :: chashbin()) -> iterator().

exact_iterator(<<Idx:160/integer>>, CHBin) ->
exact_iterator(Idx, CHBin);
exact_iterator(Idx, CHBin) ->
Pos = index_position(Idx, CHBin),
#iterator{pos = Pos, start = Pos, chbin = CHBin}.

%% @doc Return the `{Index, Owner}' pair pointed to by the iterator
-spec itr_value(iterator()) -> {index(), node()}.

Expand Down Expand Up @@ -231,7 +242,8 @@ itr_next_while(Pred, Itr) ->
%% Internal functions
%% ===================================================================

%% Convert list of {Index, Owner} pairs into `chashbin' binary representation
%% @private
%% @doc Convert list of {Index, Owner} pairs into `chashbin' binary representation
-spec create_bin([{index(), node()}],
[{node(), pos_integer()}], binary()) -> owners_bin().

Expand All @@ -241,15 +253,12 @@ create_bin([{Idx, Owner} | Owners], Nodes, Bin) ->
Bin2 = <<Bin/binary, Idx:160/integer, Id:16/integer>>,
create_bin(Owners, Nodes, Bin2).

%% Convert ring index into ring position
%% @private
%% @doc Convert ring index into ring position
-spec index_position(Index :: index() | <<_:160>>,
CHBin :: chashbin()) -> integer().

index_position(<<Idx:160/integer>>, CHBin) ->
index_position(Idx, CHBin);
index_position(Idx, #chashbin{size = Size}) ->
Inc = chash:ring_increment(Size), Idx div Inc rem Size.

%% Return iterator pointing to the given index
exact_iterator(<<Idx:160/integer>>, CHBin) ->
exact_iterator(Idx, CHBin);
exact_iterator(Idx, CHBin) ->
Pos = index_position(Idx, CHBin),
#iterator{pos = Pos, start = Pos, chbin = CHBin}.
13 changes: 6 additions & 7 deletions src/gen_nb_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,12 @@
{stop, Reason :: term(),
NewState :: term()}.

%% @spec start_link(Module, IpAddr, Port, InitParams) -> Result
%% Module = atom()
%% IpAddr = string()
%% Port = integer()
%% InitParams = [any()]
%% Result = {ok, pid()} | {error, any()}
%% @doc Start server listening on IpAddr:Port
%% @doc Start server listening on `IpAddr:Port'.
-spec start_link(Module :: atom(), IpAddr :: string(),
Port :: integer(), INitParams :: [any()]) -> {ok,
pid()} |
{error, any()}.

start_link(Module, IpAddr, Port, InitParams) ->
gen_server:start_link(?MODULE,
[Module, IpAddr, Port, InitParams], []).
Expand Down
Loading

0 comments on commit 7559873

Please sign in to comment.