use of org.apache.ignite.raft.jraft.rpc.ReadIndexRequestBuilder in project ignite-3 by apache.
the class ReadOnlyServiceImpl method executeReadIndexEvents.
private void executeReadIndexEvents(final List<ReadIndexEvent> events) {
if (events.isEmpty())
return;
ReadIndexRequestBuilder rb = raftOptions.getRaftMessagesFactory().readIndexRequest().groupId(this.node.getGroupId()).serverId(this.node.getServerId().toString());
List<ReadIndexState> states = new ArrayList<>(events.size());
List<ByteString> entries = new ArrayList<>(events.size());
for (ReadIndexEvent event : events) {
byte[] ctx = event.requestContext.get();
entries.add(ctx == null ? ByteString.EMPTY : new ByteString(ctx));
states.add(new ReadIndexState(event.requestContext, event.done, event.startTime));
}
ReadIndexRequest request = rb.entriesList(entries).build();
this.node.handleReadIndexRequest(request, new ReadIndexResponseClosure(states, request));
}
Aggregations