RowMerger (Cloud Bigtable HBase Client for Java 1.12.0 API)

com.google.cloud.bigtable.grpc.scanner

Class RowMerger

  • All Implemented Interfaces:
    io.grpc.stub.StreamObserver<com.google.bigtable.v2.ReadRowsResponse>


    public class RowMerger
    extends Object
    implements io.grpc.stub.StreamObserver<com.google.bigtable.v2.ReadRowsResponse>
    Builds a complete FlatRow from ReadRowsResponse objects. A ReadRowsResponse may contain a single FlatRow, multiple FlatRows, 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.

    Version:
    $Id: $Id
    Author:
    sduskis
    • Field Detail

      • LOG

        protected static final Logger LOG
    • Constructor Detail

      • RowMerger

        public RowMerger(io.grpc.stub.StreamObserver<FlatRow> observer)
        Constructor for RowMerger.
        Parameters:
        observer - a StreamObserver object.
    • Method Detail

      • toRows

        public static List<FlatRow> toRows(Iterable<com.google.bigtable.v2.ReadRowsResponse> responses)
        toRows.
        Parameters:
        responses - a Iterable object.
        Returns:
        a List object.
      • clearRowInProgress

        public void clearRowInProgress()
      • onNext

        public final void onNext(com.google.bigtable.v2.ReadRowsResponse readRowsResponse)
        Specified by:
        onNext in interface io.grpc.stub.StreamObserver<com.google.bigtable.v2.ReadRowsResponse>
      • getRowCountInLastMessage

        public Integer getRowCountInLastMessage()
        Returns:
        the number of rows processed in the previous call to onNext(ReadRowsResponse).
      • getLastCompletedRowKey

        public ByteString getLastCompletedRowKey()
      • onCompleted

        public void onCompleted()

        All ReadRowsResponse have been processed, and HTTP OK was sent.

        Specified by:
        onCompleted in interface io.grpc.stub.StreamObserver<com.google.bigtable.v2.ReadRowsResponse>
      • onError

        public void onError(Throwable e)
        Specified by:
        onError in interface io.grpc.stub.StreamObserver<com.google.bigtable.v2.ReadRowsResponse>