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.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[[["\u003cp\u003eThis page details the \u003ccode\u003eDataConnection\u003c/code\u003e class, which serves as an interface for interacting with the Cloud Bigtable Data API within the C++ client library.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eDataConnection\u003c/code\u003e class manages a pool of gRPC channels to optimize connections to the Cloud Bigtable service, enhancing performance through channel reuse and background refreshes to minimize latency.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version is 2.37.0-rc, and the page also covers past versions all the way back to version 2.11.0, with the current version noted as 2.14.0.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eDataConnection\u003c/code\u003e interface offers a comprehensive set of methods, including synchronous and asynchronous functions, to perform actions like reading, mutating, and sampling data within Bigtable tables.\u003c/p\u003e\n"],["\u003cp\u003eThe class is also designed to facilitate testing, allowing users to inject custom behaviors or mock objects like \u003ccode\u003eMockDataConnection\u003c/code\u003e to test their code in specific scenarios.\u003c/p\u003e\n"]]],[],null,["# Class DataConnection (2.14.0)\n\nVersion 2.14.0keyboard_arrow_down\n\n- [2.42.0-rc (latest)](/cpp/docs/reference/bigtable/latest/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.41.0](/cpp/docs/reference/bigtable/2.41.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.40.0](/cpp/docs/reference/bigtable/2.40.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.39.0](/cpp/docs/reference/bigtable/2.39.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.38.0](/cpp/docs/reference/bigtable/2.38.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.37.0](/cpp/docs/reference/bigtable/2.37.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.36.0](/cpp/docs/reference/bigtable/2.36.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.35.0](/cpp/docs/reference/bigtable/2.35.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.34.0](/cpp/docs/reference/bigtable/2.34.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.33.0](/cpp/docs/reference/bigtable/2.33.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.32.0](/cpp/docs/reference/bigtable/2.32.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.31.0](/cpp/docs/reference/bigtable/2.31.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.30.0](/cpp/docs/reference/bigtable/2.30.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.29.0](/cpp/docs/reference/bigtable/2.29.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.28.0](/cpp/docs/reference/bigtable/2.28.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.27.0](/cpp/docs/reference/bigtable/2.27.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.26.0](/cpp/docs/reference/bigtable/2.26.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.25.1](/cpp/docs/reference/bigtable/2.25.1/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.24.0](/cpp/docs/reference/bigtable/2.24.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.23.0](/cpp/docs/reference/bigtable/2.23.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.22.1](/cpp/docs/reference/bigtable/2.22.1/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.21.0](/cpp/docs/reference/bigtable/2.21.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.20.0](/cpp/docs/reference/bigtable/2.20.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.19.0](/cpp/docs/reference/bigtable/2.19.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.18.0](/cpp/docs/reference/bigtable/2.18.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.17.0](/cpp/docs/reference/bigtable/2.17.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.16.0](/cpp/docs/reference/bigtable/2.16.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.15.1](/cpp/docs/reference/bigtable/2.15.1/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.14.0](/cpp/docs/reference/bigtable/2.14.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.13.0](/cpp/docs/reference/bigtable/2.13.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.12.0](/cpp/docs/reference/bigtable/2.12.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection)\n- [2.11.0](/cpp/docs/reference/bigtable/2.11.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection) \nA connection to the Cloud Bigtable Data API. \nThis interface defines pure-virtual methods for each of the user-facing overload sets in [`Table`](/cpp/docs/reference/bigtable/2.14.0/classgoogle_1_1cloud_1_1bigtable_1_1Table). This allows users to inject custom behavior (e.g., with a Google Mock object) in a [`Table`](/cpp/docs/reference/bigtable/2.14.0/classgoogle_1_1cloud_1_1bigtable_1_1Table) object for use in their own tests.\n\nTo create a concrete instance, see [`MakeDataConnection()`](/cpp/docs/reference/bigtable/2.14.0/namespacegoogle_1_1cloud_1_1bigtable).\n\nFor mocking, see [`bigtable_mocks::MockDataConnection`](/cpp/docs/reference/bigtable/2.14.0/classgoogle_1_1cloud_1_1bigtable__mocks_1_1MockDataConnection).\n\n###### Connection Pool\n\nThis class opens a number of [gRPC Channels](https://grpc.io/docs/what-is-grpc/core-concepts/#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`](/cpp/docs/reference/bigtable/2.14.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection) objects when possible.\nThe exact number of channels can be configured with the [`google::cloud::GrpcNumChannelsOption`](https://cloud.google.com/cpp/docs/reference/common/latest/structgoogle_1_1cloud_1_1GrpcNumChannelsOption.html). 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.\n\nEach request sent from the client library cycles through the channels in the connection pool in a round robin fashion.\n\nUnused 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`](/cpp/docs/reference/bigtable/2.14.0/structgoogle_1_1cloud_1_1bigtable_1_1MinConnectionRefreshOption) and [`bigtable::MaxConnectionRefreshOption`](/cpp/docs/reference/bigtable/2.14.0/structgoogle_1_1cloud_1_1bigtable_1_1MaxConnectionRefreshOption).\n\nFunctions\n---------\n\n### virtual options()\n\n### virtual Apply(std::string const \\&, SingleRowMutation)\n\n### virtual AsyncApply(std::string const \\&, SingleRowMutation)\n\n### virtual BulkApply(std::string const \\&, BulkMutation)\n\n### virtual AsyncBulkApply(std::string const \\&, BulkMutation)\n\n### virtual ReadRows(std::string const \\&, RowSet, std::int64_t, Filter)\n\nPrefer to use [`ReadRowsFull()`](/cpp/docs/reference/bigtable/2.14.0/classgoogle_1_1cloud_1_1bigtable_1_1DataConnection#classgoogle_1_1cloud_1_1bigtable_1_1DataConnection_1a6d020c8d2a384ab2c09ee643aa01900e) in mocks.\n\n### virtual ReadRowsFull(ReadRowsParams)\n\n### virtual ReadRow(std::string const \\&, std::string, Filter)\n\n### virtual CheckAndMutateRow(std::string const \\&, std::string, Filter, std::vector\\\u003c Mutation \\\u003e, std::vector\\\u003c Mutation \\\u003e)\n\n### virtual AsyncCheckAndMutateRow(std::string const \\&, std::string, Filter, std::vector\\\u003c Mutation \\\u003e, std::vector\\\u003c Mutation \\\u003e)\n\n### virtual SampleRows(std::string const \\&)\n\n### virtual AsyncSampleRows(std::string const \\&)\n\n### virtual ReadModifyWriteRow(google::bigtable::v2::ReadModifyWriteRowRequest)\n\n### virtual AsyncReadModifyWriteRow(google::bigtable::v2::ReadModifyWriteRowRequest)\n\n### virtual AsyncReadRows(std::string const \\&, std::function\\\u003c future\\\u003c bool \\\u003e(Row)\\\u003e, std::function\\\u003c void(Status)\\\u003e, RowSet, std::int64_t, Filter)\n\n### virtual AsyncReadRow(std::string const \\&, std::string, Filter)"]]