Search in sources :

Example 1 with StreamException

use of org.apache.ratis.protocol.exceptions.StreamException 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());
}
Also used : MessageStreamRequestTypeProto(org.apache.ratis.proto.RaftProtos.MessageStreamRequestTypeProto) ClientInvocationId(org.apache.ratis.protocol.ClientInvocationId) StreamException(org.apache.ratis.protocol.exceptions.StreamException)

Aggregations

MessageStreamRequestTypeProto (org.apache.ratis.proto.RaftProtos.MessageStreamRequestTypeProto)1 ClientInvocationId (org.apache.ratis.protocol.ClientInvocationId)1 StreamException (org.apache.ratis.protocol.exceptions.StreamException)1