org.apache.ratis.proto.RaftProtos.RequestVoteRequestProto Java Examples
The following examples show how to use
org.apache.ratis.proto.RaftProtos.RequestVoteRequestProto.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FakeRatisFollower.java From hadoop-ozone with Apache License 2.0 | 6 votes |
public static RequestVoteReplyProto requestVote(RaftPeerId raftPeerId, RequestVoteRequestProto request) { addLatency(); System.out.println("Request vote response"); return RequestVoteReplyProto.newBuilder() .setServerReply( RaftRpcReplyProto.newBuilder() .setSuccess(true) .setRequestorId(request.getServerRequest().getRequestorId()) .setReplyId(raftPeerId.toByteString()) .setCallId(request.getServerRequest().getCallId()) .setRaftGroupId(request.getServerRequest().getRaftGroupId()) ) .setTerm(request.getCandidateTerm()) .build(); }
Example #2
Source File: FollowerAppendLogEntryGenerator.java From hadoop-ozone with Apache License 2.0 | 5 votes |
/** * Pseudo sync call to request a vote. * */ private CompletableFuture<RequestVoteReplyProto> requestVote() { CompletableFuture<RequestVoteReplyProto> response = new CompletableFuture<>(); RequestVoteRequestProto voteRequest = RequestVoteRequestProto.newBuilder() .setServerRequest(createServerRequest(callIdRandom.nextLong())) .setCandidateLastEntry( TermIndexProto.newBuilder() .setIndex(0L) .setTerm(term) .build() ) .build(); stub.requestVote(voteRequest, new StreamObserver<RequestVoteReplyProto>() { @Override public void onNext(RequestVoteReplyProto value) { response.complete(value); } @Override public void onError(Throwable t) { response.completeExceptionally(t); } @Override public void onCompleted() { } }); return response; }
Example #3
Source File: RaftServerProtocolServerSideTranslatorPB.java From incubator-ratis with Apache License 2.0 | 5 votes |
@Override public RequestVoteReplyProto requestVote( RpcController unused, RequestVoteRequestProto request) throws ServiceException { try { return impl.requestVote(request); } catch(IOException ioe) { throw new ServiceException(ioe); } }
Example #4
Source File: LeaderElection.java From ratis with Apache License 2.0 | 5 votes |
private int submitRequests(final long electionTerm, final TermIndex lastEntry) { int submitted = 0; for (final RaftPeer peer : others) { final RequestVoteRequestProto r = server.createRequestVoteRequest( peer.getId(), electionTerm, lastEntry); service.submit( () -> server.getServerRpc().requestVote(r)); submitted++; } return submitted; }
Example #5
Source File: LeaderElection.java From incubator-ratis with Apache License 2.0 | 5 votes |
private int submitRequests(final long electionTerm, final TermIndex lastEntry, Collection<RaftPeer> others, Executor voteExecutor) { int submitted = 0; for (final RaftPeer peer : others) { final RequestVoteRequestProto r = server.createRequestVoteRequest( peer.getId(), electionTerm, lastEntry); voteExecutor.submit(() -> server.getServerRpc().requestVote(r)); submitted++; } return submitted; }
Example #6
Source File: SimulatedServerRpc.java From incubator-ratis with Apache License 2.0 | 5 votes |
@Override public RequestVoteReplyProto requestVote(RequestVoteRequestProto request) throws IOException { RaftServerReply reply = serverHandler.getRpc() .sendRequest(new RaftServerRequest(request)); return reply.getRequestVote(); }
Example #7
Source File: RaftServerProtocolServerSideTranslatorPB.java From ratis with Apache License 2.0 | 5 votes |
@Override public RequestVoteReplyProto requestVote( RpcController unused, RequestVoteRequestProto request) throws ServiceException { try { return impl.requestVote(request); } catch(IOException ioe) { throw new ServiceException(ioe); } }
Example #8
Source File: RaftServerRequest.java From ratis with Apache License 2.0 | 4 votes |
RequestVoteRequestProto getRequestVote() { return requestVote; }
Example #9
Source File: RaftServerRequest.java From ratis with Apache License 2.0 | 4 votes |
RaftServerRequest(RequestVoteRequestProto r) { appendEntries = null; requestVote = r; installSnapshot = null; }
Example #10
Source File: RaftServerProxy.java From ratis with Apache License 2.0 | 4 votes |
@Override public RequestVoteReplyProto requestVote(RequestVoteRequestProto request) throws IOException { return getImpl(request.getServerRequest()).requestVote(request); }
Example #11
Source File: HadoopRpcService.java From ratis with Apache License 2.0 | 4 votes |
@Override public RequestVoteReplyProto requestVote( RequestVoteRequestProto request) throws IOException { return processRequest(request, request.getServerRequest().getReplyId(), proxy -> proxy.requestVote(null, request)); }
Example #12
Source File: RaftServerRequest.java From incubator-ratis with Apache License 2.0 | 4 votes |
RequestVoteRequestProto getRequestVote() { return requestVote; }
Example #13
Source File: RaftServerRequest.java From incubator-ratis with Apache License 2.0 | 4 votes |
RaftServerRequest(RequestVoteRequestProto r) { appendEntries = null; requestVote = r; installSnapshot = null; }
Example #14
Source File: RaftServerProxy.java From incubator-ratis with Apache License 2.0 | 4 votes |
@Override public RequestVoteReplyProto requestVote(RequestVoteRequestProto request) throws IOException { return getImpl(request.getServerRequest()).requestVote(request); }
Example #15
Source File: HadoopRpcService.java From incubator-ratis with Apache License 2.0 | 4 votes |
@Override public RequestVoteReplyProto requestVote( RequestVoteRequestProto request) throws IOException { return processRequest(request, request.getServerRequest().getReplyId(), proxy -> proxy.requestVote(null, request)); }
Example #16
Source File: RaftServerProtocol.java From ratis with Apache License 2.0 | votes |
RequestVoteReplyProto requestVote(RequestVoteRequestProto request) throws IOException;
Example #17
Source File: RaftServerProtocol.java From incubator-ratis with Apache License 2.0 | votes |
RequestVoteReplyProto requestVote(RequestVoteRequestProto request) throws IOException;