com.google.cloud.bigtable.grpc.scanner
Class ResponseQueueReader
- java.lang.Object
-
- com.google.cloud.bigtable.grpc.scanner.ResponseQueueReader
-
- All Implemented Interfaces:
- io.grpc.stub.ClientResponseObserver<com.google.bigtable.v2.ReadRowsRequest,FlatRow>, io.grpc.stub.StreamObserver<FlatRow>
public class ResponseQueueReader extends Object implements io.grpc.stub.StreamObserver<FlatRow>, io.grpc.stub.ClientResponseObserver<com.google.bigtable.v2.ReadRowsRequest,FlatRow>
Manages a queue ofResultQueueEntry
s ofFlatRow
.- Version:
- $Id: $Id
- Author:
- sduskis
- See Also:
for more information.
-
-
Constructor Summary
Constructors Constructor and Description ResponseQueueReader()
Constructor for ResponseQueueReader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
addRequestResultMarker()
This marker notifiesgetNextMergedRow()
to request more results and allows for flow control based on the state of theresultQueue
.int
available()
available.void
beforeStart(io.grpc.stub.ClientCallStreamObserver<com.google.bigtable.v2.ReadRowsRequest> requestStream)
void
close()
protected com.google.cloud.bigtable.grpc.scanner.ResultQueueEntry<FlatRow>
getNext()
getNext.FlatRow
getNextMergedRow()
Get the next completeFlatRow
object from the response queue.void
onCompleted()
void
onError(Throwable t)
void
onNext(FlatRow row)
-
-
-
Constructor Detail
-
ResponseQueueReader
public ResponseQueueReader()
Constructor for ResponseQueueReader.
-
-
Method Detail
-
beforeStart
public void beforeStart(io.grpc.stub.ClientCallStreamObserver<com.google.bigtable.v2.ReadRowsRequest> requestStream)
- Specified by:
beforeStart
in interfaceio.grpc.stub.ClientResponseObserver<com.google.bigtable.v2.ReadRowsRequest,FlatRow>
-
close
public void close()
-
getNextMergedRow
public FlatRow getNextMergedRow() throws IOException
Get the next completeFlatRow
object from the response queue.- Returns:
- null if end-of-stream, otherwise a complete
FlatRow
. - Throws:
IOException
- On errors.
-
getNext
protected com.google.cloud.bigtable.grpc.scanner.ResultQueueEntry<FlatRow> getNext() throws IOException
getNext.- Returns:
- a
ResultQueueEntry
object. - Throws:
IOException
- if any.
-
available
public int available()
available.- Returns:
- a int.
-
onNext
public void onNext(FlatRow row)
- Specified by:
onNext
in interfaceio.grpc.stub.StreamObserver<FlatRow>
-
onError
public void onError(Throwable t)
- Specified by:
onError
in interfaceio.grpc.stub.StreamObserver<FlatRow>
-
onCompleted
public void onCompleted()
- Specified by:
onCompleted
in interfaceio.grpc.stub.StreamObserver<FlatRow>
-
addRequestResultMarker
public void addRequestResultMarker()
This marker notifiesgetNextMergedRow()
to request more results and allows for flow control based on the state of theresultQueue
. If rows are removed from the queue quickly,getNextMergedRow()
will request more results. If rows are not read fast enough, then gRPC will stop fetching rows, and will wait until more rows are requested. This marker tellsgetNextMergedRow()
to read more rows.
-
-