Google Cloud Bigtable C++ Client 2.13.0
A C++ Client Library for Google Cloud Bigtable
|
Objects of this class pack single row mutations into bulk mutations. More...
#include <google/cloud/bigtable/mutation_batcher.h>
Classes | |
struct | Options |
Configuration for MutationBatcher . More... | |
Public Member Functions | |
MutationBatcher (Table table, Options options=Options()) | |
virtual | ~MutationBatcher ()=default |
std::pair< future< void >, future< Status > > | AsyncApply (CompletionQueue &cq, SingleRowMutation mut) |
Asynchronously apply mutation. More... | |
future< void > | AsyncWaitForNoPendingRequests () |
Asynchronously wait until all submitted mutations complete. More... | |
Protected Member Functions | |
virtual future< std::vector< FailedMutation > > | AsyncBulkApplyImpl (Table &table, BulkMutation &&mut) |
Objects of this class pack single row mutations into bulk mutations.
In order to maximize throughput when applying a lot of mutations to Cloud Bigtable, one should pack the mutations in BulkMutations
. This class helps in doing so. Create a MutationBatcher
and use MutationBatcher::AsyncApply()
to apply a large stream of mutations to the same Table
. Objects of this class will efficiently create batches of SingleRowMutations
and maintain multiple batches "in flight".
This class also offers an easy-to-use flow control mechanism to avoid unbounded growth in its internal buffers.
Applications must provide a CompletionQueue
to (asynchronously) execute these operations. The application is responsible of executing the CompletionQueue
event loop in one or more threads.
|
inlineexplicit |
|
virtualdefault |
std::pair< future< void >, future< Status > > google::cloud::bigtable::MutationBatcher::AsyncApply | ( | CompletionQueue & | cq, |
SingleRowMutation | mut | ||
) |
Asynchronously apply mutation.
The mutation will most likely be batched together with others to optimize for throughput. As a result, latency is likely to be worse than Table::AsyncApply
.
mut | the mutation. Note that this function takes ownership (and then discards) the data in the mutation. In general, a SingleRowMutation can be used to modify and/or delete multiple cells, across different columns and column families. |
cq | the completion queue that will execute the asynchronous calls, the application must ensure that one or more threads are blocked on cq.Run() . |
The completion future will report the mutation's status once it completes.
The admission future should be used for flow control. In order to bound the memory usage used by MutationBatcher
, one should not submit more mutations before the admission future is satisfied. Note that while the future is often already satisfied when the function returns, applications should not assume that this is always the case.
One should not make assumptions on which future will be satisfied first.
This quasi-synchronous example shows the intended use:
|
protectedvirtual |
future< void > google::cloud::bigtable::MutationBatcher::AsyncWaitForNoPendingRequests | ( | ) |
Asynchronously wait until all submitted mutations complete.