public class BigtableDataGrpcClient extends Object implements BigtableDataClient
In addition to calling the underlying data service API via grpc, this class adds retry logic and some useful headers.
Most of the methods are unary (single response). The only exception is ReadRows which is a streaming call.
Modifier and Type | Field and Description |
---|---|
static com.google.common.base.Predicate<com.google.bigtable.v2.MutateRowRequest> |
IS_RETRYABLE_MUTATION
Constant
IS_RETRYABLE_MUTATION |
Constructor and Description |
---|
BigtableDataGrpcClient(io.grpc.Channel channel,
ScheduledExecutorService retryExecutorService,
BigtableOptions bigtableOptions)
Constructor for BigtableDataGrpcClient.
|
Modifier and Type | Method and Description |
---|---|
com.google.bigtable.v2.CheckAndMutateRowResponse |
checkAndMutateRow(com.google.bigtable.v2.CheckAndMutateRowRequest request)
Mutate a row atomically dependent on a precondition.
|
com.google.common.util.concurrent.ListenableFuture<com.google.bigtable.v2.CheckAndMutateRowResponse> |
checkAndMutateRowAsync(com.google.bigtable.v2.CheckAndMutateRowRequest request)
Mutate a row atomically dependent on a precondition.
|
com.google.bigtable.v2.MutateRowResponse |
mutateRow(com.google.bigtable.v2.MutateRowRequest request)
Mutate a row atomically.
|
com.google.common.util.concurrent.ListenableFuture<com.google.bigtable.v2.MutateRowResponse> |
mutateRowAsync(com.google.bigtable.v2.MutateRowRequest request)
Mutate a row atomically.
|
List<com.google.bigtable.v2.MutateRowsResponse> |
mutateRows(com.google.bigtable.v2.MutateRowsRequest request)
Mutates multiple rows in a batch.
|
com.google.common.util.concurrent.ListenableFuture<List<com.google.bigtable.v2.MutateRowsResponse>> |
mutateRowsAsync(com.google.bigtable.v2.MutateRowsRequest request)
Mutates multiple rows in a batch.
|
ResultScanner<FlatRow> |
readFlatRows(com.google.bigtable.v2.ReadRowsRequest request)
Perform a scan over
FlatRow s, in key order. |
ScanHandler |
readFlatRows(com.google.bigtable.v2.ReadRowsRequest request,
io.grpc.stub.StreamObserver<FlatRow> observer)
Perform a streaming read of
FlatRow s in key order. |
com.google.common.util.concurrent.ListenableFuture<List<FlatRow>> |
readFlatRowsAsync(com.google.bigtable.v2.ReadRowsRequest request)
Read multiple
FlatRow s into an in-memory list, in key order. |
List<FlatRow> |
readFlatRowsList(com.google.bigtable.v2.ReadRowsRequest request)
Returns a list of
FlatRow s, in key order. |
com.google.bigtable.v2.ReadModifyWriteRowResponse |
readModifyWriteRow(com.google.bigtable.v2.ReadModifyWriteRowRequest request)
Perform an atomic read-modify-write operation on a row.
|
com.google.common.util.concurrent.ListenableFuture<com.google.bigtable.v2.ReadModifyWriteRowResponse> |
readModifyWriteRowAsync(com.google.bigtable.v2.ReadModifyWriteRowRequest request)
Perform an atomic read-modify-write operation on a row,
|
ResultScanner<com.google.bigtable.v2.Row> |
readRows(com.google.bigtable.v2.ReadRowsRequest request)
Perform a scan over
Row s, in key order. |
com.google.common.util.concurrent.ListenableFuture<List<com.google.bigtable.v2.Row>> |
readRowsAsync(com.google.bigtable.v2.ReadRowsRequest request)
Read multiple
Row s into an in-memory list, in key order. |
List<com.google.bigtable.v2.SampleRowKeysResponse> |
sampleRowKeys(com.google.bigtable.v2.SampleRowKeysRequest request)
Sample row keys from a table.
|
com.google.common.util.concurrent.ListenableFuture<List<com.google.bigtable.v2.SampleRowKeysResponse>> |
sampleRowKeysAsync(com.google.bigtable.v2.SampleRowKeysRequest request)
Sample row keys from a table, returning a Future that will complete when the sampling has
completed.
|
void |
setCallOptionsFactory(CallOptionsFactory callOptionsFactory)
Sets a
CallOptionsFactory which creates CallOptions |
public static final com.google.common.base.Predicate<com.google.bigtable.v2.MutateRowRequest> IS_RETRYABLE_MUTATION
IS_RETRYABLE_MUTATION
public BigtableDataGrpcClient(io.grpc.Channel channel, ScheduledExecutorService retryExecutorService, BigtableOptions bigtableOptions)
Constructor for BigtableDataGrpcClient.
channel
- a Channel
object.retryExecutorService
- a ScheduledExecutorService
object.bigtableOptions
- a BigtableOptions
object.public void setCallOptionsFactory(CallOptionsFactory callOptionsFactory)
CallOptionsFactory
which creates CallOptions
setCallOptionsFactory
in interface BigtableDataClient
callOptionsFactory
- a CallOptionsFactory
object.public com.google.bigtable.v2.MutateRowResponse mutateRow(com.google.bigtable.v2.MutateRowRequest request)
mutateRow
in interface BigtableDataClient
request
- a MutateRowRequest
object.MutateRowResponse
object.public com.google.common.util.concurrent.ListenableFuture<com.google.bigtable.v2.MutateRowResponse> mutateRowAsync(com.google.bigtable.v2.MutateRowRequest request)
mutateRowAsync
in interface BigtableDataClient
request
- a MutateRowRequest
object.ListenableFuture
that will finish when
the mutation has completed.public List<com.google.bigtable.v2.MutateRowsResponse> mutateRows(com.google.bigtable.v2.MutateRowsRequest request)
mutateRows
in interface BigtableDataClient
request
- a MutateRowsRequest
object.List
object.public com.google.common.util.concurrent.ListenableFuture<List<com.google.bigtable.v2.MutateRowsResponse>> mutateRowsAsync(com.google.bigtable.v2.MutateRowsRequest request)
mutateRowsAsync
in interface BigtableDataClient
request
- a MutateRowsRequest
object.ListenableFuture
that will finish when the mutations have all been completed.public com.google.bigtable.v2.CheckAndMutateRowResponse checkAndMutateRow(com.google.bigtable.v2.CheckAndMutateRowRequest request)
checkAndMutateRow
in interface BigtableDataClient
request
- a CheckAndMutateRowRequest
object.CheckAndMutateRowResponse
object.public com.google.common.util.concurrent.ListenableFuture<com.google.bigtable.v2.CheckAndMutateRowResponse> checkAndMutateRowAsync(com.google.bigtable.v2.CheckAndMutateRowRequest request)
checkAndMutateRowAsync
in interface BigtableDataClient
request
- a CheckAndMutateRowRequest
object.ListenableFuture
that will finish when
the mutation has completed.public com.google.bigtable.v2.ReadModifyWriteRowResponse readModifyWriteRow(com.google.bigtable.v2.ReadModifyWriteRowRequest request)
readModifyWriteRow
in interface BigtableDataClient
request
- a ReadModifyWriteRowRequest
object.ReadModifyWriteRowResponse
object.public com.google.common.util.concurrent.ListenableFuture<com.google.bigtable.v2.ReadModifyWriteRowResponse> readModifyWriteRowAsync(com.google.bigtable.v2.ReadModifyWriteRowRequest request)
readModifyWriteRowAsync
in interface BigtableDataClient
request
- a ReadModifyWriteRowRequest
object.ListenableFuture
that will finish when
the mutation has completed.public List<com.google.bigtable.v2.SampleRowKeysResponse> sampleRowKeys(com.google.bigtable.v2.SampleRowKeysRequest request)
sampleRowKeys
in interface BigtableDataClient
request
- a SampleRowKeysRequest
object.List
object.public com.google.common.util.concurrent.ListenableFuture<List<com.google.bigtable.v2.SampleRowKeysResponse>> sampleRowKeysAsync(com.google.bigtable.v2.SampleRowKeysRequest request)
sampleRowKeysAsync
in interface BigtableDataClient
request
- a SampleRowKeysRequest
object.ListenableFuture
object.public com.google.common.util.concurrent.ListenableFuture<List<com.google.bigtable.v2.Row>> readRowsAsync(com.google.bigtable.v2.ReadRowsRequest request)
Row
s into an in-memory list, in key order.readRowsAsync
in interface BigtableDataClient
request
- a ReadRowsRequest
object.ListenableFuture
that will finish when
all reads have completed.public com.google.common.util.concurrent.ListenableFuture<List<FlatRow>> readFlatRowsAsync(com.google.bigtable.v2.ReadRowsRequest request)
FlatRow
s into an in-memory list, in key order.readFlatRowsAsync
in interface BigtableDataClient
request
- a ReadRowsRequest
object.ListenableFuture
that will finish when
all reads have completed.public List<FlatRow> readFlatRowsList(com.google.bigtable.v2.ReadRowsRequest request)
FlatRow
s, in key order.readFlatRowsList
in interface BigtableDataClient
request
- a ReadRowsRequest
object.FlatRow
s.public ResultScanner<com.google.bigtable.v2.Row> readRows(com.google.bigtable.v2.ReadRowsRequest request)
Row
s, in key order.readRows
in interface BigtableDataClient
request
- a ReadRowsRequest
object.ResultScanner
object.public ResultScanner<FlatRow> readFlatRows(com.google.bigtable.v2.ReadRowsRequest request)
FlatRow
s, in key order.readFlatRows
in interface BigtableDataClient
request
- a ReadRowsRequest
object.ResultScanner
object.public ScanHandler readFlatRows(com.google.bigtable.v2.ReadRowsRequest request, io.grpc.stub.StreamObserver<FlatRow> observer)
FlatRow
s in key order. It would be a good idea to turn on
client side timeouts via CallOptionsConfig.Builder.setUseTimeout(boolean)
.readFlatRows
in interface BigtableDataClient
request
- a ReadRowsRequest
object.observer
- a StreamObserver
objectScanHandler
which can be used to either cancel or timeout the request.