@InternalApi(value="For internal usage only") public class RowMerger extends Object implements io.grpc.stub.StreamObserver<com.google.bigtable.v2.ReadRowsResponse>
FlatRow
from ReadRowsResponse
objects. A
ReadRowsResponse
may contain a single FlatRow
, multiple
FlatRow
s, or even a part of a Cell
if the cell is
Each RowMerger object is valid only for building a single FlatRow. Expected usage is along the lines of:
StreamObserver
<FlatRow
> observer = ...; RowMerger rowMerger = new RowMerger(observer); ... rowMerger.onNext(...); .. rowMerger.onComplete();
When a complete row is found, StreamObserver.onNext(Object)
will be
called. StreamObserver.onError(Throwable)
will be called for
NOTE: RowMerger is not threadsafe.
For internal use only - public for technical reasons.
Constructor and Description |
---|
RowMerger(io.grpc.stub.StreamObserver<FlatRow> observer)
Constructor for RowMerger.
|
Modifier and Type | Method and Description |
---|---|
void |
clearRowInProgress() |
com.google.protobuf.ByteString |
getLastCompletedRowKey() |
Integer |
getRowCountInLastMessage() |
void |
onCompleted() |
void |
onError(Throwable e) |
void |
onNext(com.google.bigtable.v2.ReadRowsResponse readRowsResponse) |
static List<FlatRow> |
toRows(Iterable<com.google.bigtable.v2.ReadRowsResponse> responses)
toRows.
|
protected static final Logger LOG
public RowMerger(io.grpc.stub.StreamObserver<FlatRow> observer)
observer
- a StreamObserver
object.public static List<FlatRow> toRows(Iterable<com.google.bigtable.v2.ReadRowsResponse> responses)
public void clearRowInProgress()
public final void onNext(com.google.bigtable.v2.ReadRowsResponse readRowsResponse)
onNext
in interface io.grpc.stub.StreamObserver<com.google.bigtable.v2.ReadRowsResponse>
public Integer getRowCountInLastMessage()
onNext(ReadRowsResponse)
.public com.google.protobuf.ByteString getLastCompletedRowKey()
public void onCompleted()
All ReadRowsResponse
have been processed, and HTTP OK was sent.
onCompleted
in interface io.grpc.stub.StreamObserver<com.google.bigtable.v2.ReadRowsResponse>
public void onError(Throwable e)
onError
in interface io.grpc.stub.StreamObserver<com.google.bigtable.v2.ReadRowsResponse>