@InternalApi public class RowMerger<RowT> extends Object implements Reframer<RowT,com.google.bigtable.v2.ReadRowsResponse>
Reframer
that feeds the row merging StateMachine
.
ReframingResponseObserver
pushes ReadRowsResponse.CellChunk
s into this class and pops fully merged logical
rows. Example usage:
RowMerger<Row> rowMerger = new RowMerger<>(myRowBuilder);
while(responseIterator.hasNext()) {
ReadRowsResponse response = responseIterator.next();
if (rowMerger.hasFullFrame()) {
Row row = rowMerger.pop();
// Do something with row.
} else {
rowMerger.push(response);
}
}
if (rowMerger.hasPartialFrame()) {
throw new RuntimeException("Incomplete stream");
}
This class is considered an internal implementation detail and not meant to be used by applications.
Package-private for internal use.
for more details
Constructor and Description |
---|
RowMerger(RowAdapter.RowBuilder<RowT> rowBuilder) |
Modifier and Type | Method and Description |
---|---|
boolean |
hasFullFrame()
Checks if there is a frame to be popped.
|
boolean |
hasPartialFrame()
Checks if there is any incomplete data.
|
RowT |
pop()
Returns and removes the current completed frame.
|
void |
push(com.google.bigtable.v2.ReadRowsResponse response)
Refill internal buffers with inner/upstream response.
|
public RowMerger(RowAdapter.RowBuilder<RowT> rowBuilder)
public void push(com.google.bigtable.v2.ReadRowsResponse response)
Reframer
Reframer.hasFullFrame()
returns false.public boolean hasFullFrame()
Reframer
Note that this method might update internal to buffer the next response.
hasFullFrame
in interface Reframer<RowT,com.google.bigtable.v2.ReadRowsResponse>
public boolean hasPartialFrame()
Reframer
hasPartialFrame
in interface Reframer<RowT,com.google.bigtable.v2.ReadRowsResponse>
Copyright © 2019 Google LLC. All rights reserved.