-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
follower ignores pre_vote and request_vote
- Loading branch information
Alex Valiushko
committed
May 14, 2023
1 parent
ee12cc5
commit 453965a
Showing
5 changed files
with
320 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
%% This Source Code Form is subject to the terms of the Mozilla Public | ||
%% | ||
%% Copyright (c) 2017-2022 VMware, Inc. or its affiliates. All rights reserved. | ||
%% | ||
-module(ra_voter). | ||
|
||
-export([ | ||
new_nonvoter/1, | ||
status/1, | ||
peer_status/2 | ||
]). | ||
|
||
new_nonvoter(State) -> | ||
TargetIdx = maps:get(commit_index, State), | ||
{no, #{round => 0, target => TargetIdx , ts => os:system_time(millisecond)}}. | ||
|
||
status(State) -> | ||
case maps:get(voter, State) of | ||
undefined -> | ||
MyId = ra_server:id(State), | ||
#{cluster := Cluster} = State, | ||
peer_status(MyId, Cluster); | ||
Voter -> Voter | ||
end. | ||
|
||
peer_status(PeerId, Cluster) -> | ||
Peer = maps:get(PeerId, Cluster, undefined), | ||
maps:get(voter, Peer, yes). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.