Google Cloud Bigtable C++ Client 2.13.0
A C++ Client Library for Google Cloud Bigtable
Loading...
Searching...
No Matches
Public Member Functions | List of all members
google::cloud::bigtable::GenericPollingPolicy< Retry, Backoff > Class Template Reference

Construct a polling policy from existing Retry and Backoff policies. More...

#include <google/cloud/bigtable/polling_policy.h>

Public Member Functions

 GenericPollingPolicy (internal::RPCPolicyParameters defaults)
 
 GenericPollingPolicy (Retry retry, Backoff backoff)
 
std::unique_ptr< PollingPolicyclone () const override
 Return a new copy of this object. More...
 
void Setup (grpc::ClientContext &context) override
 
bool IsPermanentError (Status const &status) override
 Return true if status represents a permanent error that cannot be retried. More...
 
bool OnFailure (Status const &status) override
 Handle an RPC failure. More...
 
bool Exhausted () override
 Return true if we cannot try again. More...
 
std::chrono::milliseconds WaitPeriod () override
 Return for how long we should wait before trying again. More...
 
virtual bool IsPermanentError (grpc::Status const &status)
 Return true if status represents a permanent error that cannot be retried. More...
 
virtual bool OnFailure (grpc::Status const &status)
 Handle an RPC failure. More...
 

Detailed Description

template<typename Retry = LimitedTimeRetryPolicy, typename Backoff = ExponentialBackoffPolicy>
class google::cloud::bigtable::GenericPollingPolicy< Retry, Backoff >

Construct a polling policy from existing Retry and Backoff policies.

A polling policy can be built by composing a retry and backoff policy. For example, to create a polling policy that "retries N times, waiting a fixed period between retries" you could compose the "try N times" retry policy with the "wait a fixed period between retries".

This class makes it easier to create such composed polling policies.

Template Parameters
Retrythe RPC retry strategy used to limit the number or the total duration of the polling strategy.
Backoffthe RPC backoff strategy used to control how often the library polls.

Constructor & Destructor Documentation

◆ GenericPollingPolicy() [1/2]

template<typename Retry = LimitedTimeRetryPolicy, typename Backoff = ExponentialBackoffPolicy>
google::cloud::bigtable::GenericPollingPolicy< Retry, Backoff >::GenericPollingPolicy ( internal::RPCPolicyParameters  defaults)
inlineexplicit

◆ GenericPollingPolicy() [2/2]

template<typename Retry = LimitedTimeRetryPolicy, typename Backoff = ExponentialBackoffPolicy>
google::cloud::bigtable::GenericPollingPolicy< Retry, Backoff >::GenericPollingPolicy ( Retry  retry,
Backoff  backoff 
)
inline

Member Function Documentation

◆ clone()

template<typename Retry = LimitedTimeRetryPolicy, typename Backoff = ExponentialBackoffPolicy>
std::unique_ptr< PollingPolicy > google::cloud::bigtable::GenericPollingPolicy< Retry, Backoff >::clone ( ) const
inlineoverridevirtual

Return a new copy of this object.

Typically implemented as

return std::unique_ptr<PollingPolicy>(new Foo(*this));

Implements google::cloud::bigtable::PollingPolicy.

◆ Exhausted()

template<typename Retry = LimitedTimeRetryPolicy, typename Backoff = ExponentialBackoffPolicy>
bool google::cloud::bigtable::GenericPollingPolicy< Retry, Backoff >::Exhausted ( )
inlineoverridevirtual

Return true if we cannot try again.

Implements google::cloud::bigtable::PollingPolicy.

◆ IsPermanentError() [1/2]

virtual bool google::cloud::bigtable::PollingPolicy::IsPermanentError ( grpc::Status const &  status)
inlinevirtualinherited

Return true if status represents a permanent error that cannot be retried.

TODO(#2344): remove grpc::Status version.

◆ IsPermanentError() [2/2]

template<typename Retry = LimitedTimeRetryPolicy, typename Backoff = ExponentialBackoffPolicy>
bool google::cloud::bigtable::GenericPollingPolicy< Retry, Backoff >::IsPermanentError ( Status const &  status)
inlineoverridevirtual

Return true if status represents a permanent error that cannot be retried.

Implements google::cloud::bigtable::PollingPolicy.

◆ OnFailure() [1/2]

virtual bool google::cloud::bigtable::PollingPolicy::OnFailure ( grpc::Status const &  status)
inlinevirtualinherited

Handle an RPC failure.

TODO(#2344): remove grpc::Status version.

Returns
true if the RPC operation should be retried.

◆ OnFailure() [2/2]

template<typename Retry = LimitedTimeRetryPolicy, typename Backoff = ExponentialBackoffPolicy>
bool google::cloud::bigtable::GenericPollingPolicy< Retry, Backoff >::OnFailure ( Status const &  status)
inlineoverridevirtual

Handle an RPC failure.

Returns
true if the RPC operation should be retried.

Implements google::cloud::bigtable::PollingPolicy.

◆ Setup()

template<typename Retry = LimitedTimeRetryPolicy, typename Backoff = ExponentialBackoffPolicy>
void google::cloud::bigtable::GenericPollingPolicy< Retry, Backoff >::Setup ( grpc::ClientContext &  context)
inlineoverridevirtual

◆ WaitPeriod()

template<typename Retry = LimitedTimeRetryPolicy, typename Backoff = ExponentialBackoffPolicy>
std::chrono::milliseconds google::cloud::bigtable::GenericPollingPolicy< Retry, Backoff >::WaitPeriod ( )
inlineoverridevirtual

Return for how long we should wait before trying again.

Implements google::cloud::bigtable::PollingPolicy.