Package org.apache.arrow.flight.grpc
Class StatusUtils
java.lang.Object
org.apache.arrow.flight.grpc.StatusUtils
Utilities to adapt gRPC and Flight status objects.
NOT A PUBLIC CLASS, interface is not guaranteed to remain stable.
-
Method Summary
Modifier and TypeMethodDescriptionstatic FlightRuntimeException
fromGrpcRuntimeException
(io.grpc.StatusRuntimeException sre) Convert from a gRPC exception to a Flight exception.static CallStatus
fromGrpcStatus
(io.grpc.Status status) Convert from a gRPC status to a Flight status.static CallStatus
fromGrpcStatusAndTrailers
(io.grpc.Status status, io.grpc.Metadata trailers) Convert from a gRPC Status & trailers to a Flight status.static FlightStatusCode
fromGrpcStatusCode
(io.grpc.Status.Code code) Convert from a gRPC status code to a Flight status code.static FlightRuntimeException
Convert arbitrary exceptions to aFlightRuntimeException
.static Throwable
Convert arbitrary exceptions to aStatusRuntimeException
orStatusException
.static io.grpc.Status
toGrpcStatus
(CallStatus status) Convert from a Flight status to a gRPC status.static io.grpc.Status.Code
Convert from a Flight status code to a gRPC status code.static <FROM,
TO> Iterator<TO> wrapIterator
(Iterator<FROM> fromIterator, Function<? super FROM, ? extends TO> transformer) Maps a transformation function to the elements of an iterator, while wrapping exceptions inFlightRuntimeException
.
-
Method Details
-
toGrpcStatusCode
Convert from a Flight status code to a gRPC status code. -
fromGrpcStatusCode
Convert from a gRPC status code to a Flight status code. -
fromGrpcStatusAndTrailers
public static CallStatus fromGrpcStatusAndTrailers(io.grpc.Status status, io.grpc.Metadata trailers) Convert from a gRPC Status & trailers to a Flight status. -
fromGrpcStatus
Convert from a gRPC status to a Flight status. -
toGrpcStatus
Convert from a Flight status to a gRPC status. -
fromGrpcRuntimeException
Convert from a gRPC exception to a Flight exception. -
fromThrowable
Convert arbitrary exceptions to aFlightRuntimeException
. -
toGrpcException
Convert arbitrary exceptions to aStatusRuntimeException
orStatusException
.Such exceptions can be passed to
StreamObserver.onError(Throwable)
and will give the client a reasonable error message. -
wrapIterator
public static <FROM,TO> Iterator<TO> wrapIterator(Iterator<FROM> fromIterator, Function<? super FROM, ? extends TO> transformer) Maps a transformation function to the elements of an iterator, while wrapping exceptions inFlightRuntimeException
.
-