Google Cloud Bigtable C++ Client  0.11.0
A C++ Client Library for Google Cloud Bigtable
Public Member Functions | List of all members
google::cloud::bigtable::v0::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 () override
 Return a new copy of this object. More...
 
void Setup (grpc::ClientContext &context) override
 
bool IsPermanentError (google::cloud::Status const &status) override
 Return true if status represents a permanent error that cannot be retried. More...
 
bool OnFailure (google::cloud::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::v0::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.

Definition at line 108 of file polling_policy.h.

Constructor & Destructor Documentation

◆ GenericPollingPolicy() [1/2]

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

Definition at line 110 of file polling_policy.h.

◆ GenericPollingPolicy() [2/2]

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

Definition at line 113 of file polling_policy.h.

Member Function Documentation

◆ clone()

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

Return a new copy of this object.

Typically implemented as

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

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

Definition at line 117 of file polling_policy.h.

◆ Exhausted()

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

Return true if we cannot try again.

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

Definition at line 134 of file polling_policy.h.

◆ IsPermanentError() [1/2]

virtual bool google::cloud::bigtable::v0::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.

Definition at line 53 of file polling_policy.h.

◆ IsPermanentError() [2/2]

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

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

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

Definition at line 126 of file polling_policy.h.

◆ OnFailure() [1/2]

virtual bool google::cloud::bigtable::v0::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.

Definition at line 69 of file polling_policy.h.

◆ OnFailure() [2/2]

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

Handle an RPC failure.

Returns
true if the RPC operation should be retried.

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

Definition at line 130 of file polling_policy.h.

◆ Setup()

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

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

Definition at line 121 of file polling_policy.h.

◆ WaitPeriod()

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

Return for how long we should wait before trying again.

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

Definition at line 136 of file polling_policy.h.