Class DataConnection (2.22.0)

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
TypeDescription
Options

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

Parameters
NameDescription
table_name std::string const &
mut SingleRowMutation
Returns
TypeDescription
Status

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

Parameters
NameDescription
table_name std::string const &
mut SingleRowMutation
Returns
TypeDescription
future< Status >

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

Parameters
NameDescription
table_name std::string const &
mut BulkMutation
Returns
TypeDescription
std::vector< FailedMutation >

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

Parameters
NameDescription
table_name std::string const &
mut BulkMutation
Returns
TypeDescription
future< std::vector< FailedMutation > >

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

Prefer to use ReadRowsFull() in mocks.

Parameters
NameDescription
table_name std::string const &
row_set RowSet
rows_limit std::int64_t
filter Filter
Returns
TypeDescription
RowReader

virtual ReadRowsFull(ReadRowsParams)

Parameter
NameDescription
params ReadRowsParams
Returns
TypeDescription
RowReader

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

Parameters
NameDescription
table_name std::string const &
row_key std::string
filter Filter
Returns
TypeDescription
StatusOr< std::pair< bool, Row > >

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

Parameters
NameDescription
table_name std::string const &
row_key std::string
filter Filter
true_mutations std::vector< Mutation >
false_mutations std::vector< Mutation >
Returns
TypeDescription
StatusOr< MutationBranch >

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

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

virtual SampleRows(std::string const &)

Parameter
NameDescription
table_name std::string const &
Returns
TypeDescription
StatusOr< std::vector< RowKeySample > >

virtual AsyncSampleRows(std::string const &)

Parameter
NameDescription
table_name std::string const &
Returns
TypeDescription
future< StatusOr< std::vector< RowKeySample > > >

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

Parameter
NameDescription
request google::bigtable::v2::ReadModifyWriteRowRequest
Returns
TypeDescription
StatusOr< Row >

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

Parameter
NameDescription
request google::bigtable::v2::ReadModifyWriteRowRequest
Returns
TypeDescription
future< StatusOr< Row > >

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

Parameters
NameDescription
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
TypeDescription
void

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

Parameters
NameDescription
table_name std::string const &
row_key std::string
filter Filter
Returns
TypeDescription
future< StatusOr< std::pair< bool, Row > > >