use of org.apache.ratis.proto.RaftProtos.MessageStreamRequestTypeProto in project incubator-ratis by apache.
the class MessageStreamRequests method streamEndOfRequestAsync.
CompletableFuture<ByteString> streamEndOfRequestAsync(RaftClientRequest request) {
final MessageStreamRequestTypeProto stream = request.getType().getMessageStream();
Preconditions.assertTrue(stream.getEndOfRequest());
final ClientInvocationId key = ClientInvocationId.valueOf(request.getClientId(), stream.getStreamId());
final PendingStream pending = streams.remove(key);
if (pending == null) {
return JavaUtils.completeExceptionally(new StreamException(name + ": " + key + " not found"));
}
return pending.getBytes(stream.getMessageId(), request.getMessage());
}
use of org.apache.ratis.proto.RaftProtos.MessageStreamRequestTypeProto in project incubator-ratis by apache.
the class MessageStreamRequests method streamAsync.
CompletableFuture<?> streamAsync(RaftClientRequest request) {
final MessageStreamRequestTypeProto stream = request.getType().getMessageStream();
Preconditions.assertTrue(!stream.getEndOfRequest());
final ClientInvocationId key = ClientInvocationId.valueOf(request.getClientId(), stream.getStreamId());
final PendingStream pending = streams.computeIfAbsent(key);
return pending.append(stream.getMessageId(), request.getMessage());
}
Aggregations