MCPcopy Create free account
hub / github.com/e2wugui/zeze / processRequest

Method processRequest

ZezeJava/ZezeJava/src/main/java/Zeze/Raft/Server.java:206–228  ·  view source on GitHub ↗
(Protocol<?> p, ProtocolFactoryHandle<?> factoryHandle)

Source from the content-addressed store, hash-verified

204 }
205
206 public long processRequest(Protocol<?> p, ProtocolFactoryHandle<?> factoryHandle) {
207 return Task.call(() -> {
208 if (raft.waitLeaderReady()) {
209 UniqueRequestState state = raft.getLogSequence().tryGetRequestState(p);
210 if (state != null) {
211 if (state != UniqueRequestState.NOT_FOUND) {
212 if (state.isApplied()) {
213 p.SendResultCode(Procedure.RaftApplied,
214 state.getRpcResult().size() > 0 ? state.getRpcResult() : null);
215 return 0L;
216 }
217 p.SendResultCode(Procedure.DuplicateRequest);
218 return 0L;
219 }
220 return p.handle(this, factoryHandle);
221 }
222 p.SendResultCode(Procedure.RaftExpired);
223 return 0L;
224 }
225 trySendLeaderIs(p.getSender());
226 return 0L;
227 }, p, Protocol::trySendResultCode);
228 }
229
230 /**
231 * Raft.Server的线程派发模式总是完全

Callers 2

dispatchProtocolMethod · 0.95
ProcessProxyRequestMethod · 0.80

Calls 11

callMethod · 0.95
isAppliedMethod · 0.95
getRpcResultMethod · 0.95
trySendLeaderIsMethod · 0.95
waitLeaderReadyMethod · 0.80
tryGetRequestStateMethod · 0.80
getLogSequenceMethod · 0.80
sizeMethod · 0.65
handleMethod · 0.65
getSenderMethod · 0.65
SendResultCodeMethod · 0.45

Tested by

no test coverage detected