Class DataConnection (2.29.0-rc)

A connection to the Cloud Bigtable Data API.

This interface defines pure-virtual methods for each of the user-facing overload sets in Table. This allows users to inject custom behavior (e.g., with a Google Mock object) in a Table object for use in their own tests.

To create a concrete instance, see MakeDataConnection().

For mocking, see bigtable_mocks::MockDataConnection.

Connection Pool

This class opens a number of gRPC Channels upon its construction. These channels each initiate a connection to the Cloud Bigtable service. This is a relatively slow operation that can take milliseconds, so applications are advised to reuse DataConnection objects when possible. The exact number of channels can be configured with the google::cloud::GrpcNumChannelsOption. If this option is not set, the class creates between 1 and 64 channels. The specific algorithm and number of channels is an implementation detail, and subject to change without notice.

Each request sent from the client library cycles through the channels in the connection pool in a round robin fashion.

Unused gRPC channels can enter an idle state. Refreshing them during a request may incur additional latency. To avoid this, the client library keeps connections open by refreshing the channels in a background thread. Advanced users can configure the frequency of the refreshes, or disable this feature, by using bigtable::MinConnectionRefreshOption and bigtable::MaxConnectionRefreshOption.

Functions

virtual options()

Returns
Type Description
Options

virtual Apply(std::string const &, SingleRowMutation)

Parameters
Name Description
table_name std::string const &
mut SingleRowMutation
Returns
Type Description
Status

virtual AsyncApply(std::string const &, SingleRowMutation)

Parameters
Name Description
table_name std::string const &
mut SingleRowMutation
Returns
Type Description
future< Status >

virtual BulkApply(std::string const &, BulkMutation)

Parameters
Name Description
table_name std::string const &
mut BulkMutation
Returns
Type Description
std::vector< FailedMutation >

virtual AsyncBulkApply(std::string const &, BulkMutation)

Parameters
Name Description
table_name std::string const &
mut BulkMutation
Returns
Type Description
future< std::vector< FailedMutation > >

virtual ReadRows(std::string const &, RowSet, std::int64_t, Filter)

Prefer to use ReadRowsFull() in mocks.

Parameters
Name Description
table_name std::string const &
row_set RowSet
rows_limit std::int64_t
filter Filter
Returns
Type Description
RowReader

virtual ReadRowsFull(ReadRowsParams)

Parameter
Name Description
params ReadRowsParams
Returns
Type Description
RowReader

virtual ReadRow(std::string const &, std::string, Filter)

Parameters
Name Description
table_name std::string const &
row_key std::string
filter Filter
Returns
Type Description
StatusOr< std::pair< bool, Row > >

virtual CheckAndMutateRow(std::string const &, std::string, Filter, std::vector< Mutation >, std::vector< Mutation >)

Parameters
Name Description
table_name std::string const &
row_key std::string
filter Filter
true_mutations std::vector< Mutation >
false_mutations std::vector< Mutation >
Returns
Type Description
StatusOr< MutationBranch >

virtual AsyncCheckAndMutateRow(std::string const &, std::string, Filter, std::vector< Mutation >, std::vector< Mutation >)

Parameters
Name Description
table_name std::string const &
row_key std::string
filter Filter
true_mutations std::vector< Mutation >
false_mutations std::vector< Mutation >
Returns
Type Description
future< StatusOr< MutationBranch > >

virtual SampleRows(std::string const &)

Parameter
Name Description
table_name std::string const &
Returns
Type Description
StatusOr< std::vector< RowKeySample > >

virtual AsyncSampleRows(std::string const &)

Parameter
Name Description
table_name std::string const &
Returns
Type Description
future< StatusOr< std::vector< RowKeySample > > >

virtual ReadModifyWriteRow(google::bigtable::v2::ReadModifyWriteRowRequest)

Parameter
Name Description
request google::bigtable::v2::ReadModifyWriteRowRequest
Returns
Type Description
StatusOr< Row >

virtual AsyncReadModifyWriteRow(google::bigtable::v2::ReadModifyWriteRowRequest)

Parameter
Name Description
request google::bigtable::v2::ReadModifyWriteRowRequest
Returns
Type Description
future< StatusOr< Row > >

virtual AsyncReadRows(std::string const &, std::function< future< bool >(Row)>, std::function< void(Status)>, RowSet, std::int64_t, Filter)

Parameters
Name Description
table_name std::string const &
on_row std::function< future< bool >(Row)>
on_finish std::function< void(Status)>
row_set RowSet
rows_limit std::int64_t
filter Filter
Returns
Type Description
void

virtual AsyncReadRow(std::string const &, std::string, Filter)

Parameters
Name Description
table_name std::string const &
row_key std::string
filter Filter
Returns
Type Description
future< StatusOr< std::pair< bool, Row > > >