Class GenericPollingPolicy<Retry, Backoff> (2.12.0)

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.

Constructors

GenericPollingPolicy(internal::RPCPolicyParameters)

Parameter
NameDescription
defaults internal::RPCPolicyParameters

GenericPollingPolicy(Retry, Backoff)

Parameters
NameDescription
retry Retry
backoff Backoff

Functions

virtual clone() const

Return a new copy of this object.

Typically implemented as ```cpp return std::unique_ptr


Returns
TypeDescription
std::unique_ptr< PollingPolicy >

virtual Setup(grpc::ClientContext &)

Parameter
NameDescription
context grpc::ClientContext &
Returns
TypeDescription
void

virtual IsPermanentError(Status const &)

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

Parameter
NameDescription
status Status const &
Returns
TypeDescription
bool

virtual OnFailure(Status const &)

Handle an RPC failure.

Parameter
NameDescription
status Status const &
Returns
TypeDescription
bool

true if the RPC operation should be retried.

virtual Exhausted()

Return true if we cannot try again.

Returns
TypeDescription
bool

virtual WaitPeriod()

Return for how long we should wait before trying again.

Returns
TypeDescription
std::chrono::milliseconds

virtual IsPermanentError(grpc::Status const &)

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

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

Parameter
NameDescription
status grpc::Status const &
Returns
TypeDescription
bool

virtual OnFailure(grpc::Status const &)

Handle an RPC failure.

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

Parameter
NameDescription
status grpc::Status const &
Returns
TypeDescription
bool

true if the RPC operation should be retried.