Class GenericPollingPolicy<Retry, Backoff> (2.31.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
Name Description
defaults internal::RPCPolicyParameters

GenericPollingPolicy(Retry, Backoff)

Parameters
Name Description
retry Retry
backoff Backoff

Functions

virtual clone() const

Return a new copy of this object.

Typically implemented as

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

virtual Setup(grpc::ClientContext &)

Parameter
Name Description
context grpc::ClientContext &
Returns
Type Description
void

virtual IsPermanentError(Status const &)

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

Parameter
Name Description
status Status const &
Returns
Type Description
bool

virtual OnFailure(Status const &)

Handle an RPC failure.

Parameter
Name Description
status Status const &
Returns
Type Description
bool

true if the RPC operation should be retried.

virtual Exhausted()

Return true if we cannot try again.

Returns
Type Description
bool

virtual WaitPeriod()

Return for how long we should wait before trying again.

Returns
Type Description
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
Name Description
status grpc::Status const &
Returns
Type Description
bool

virtual OnFailure(grpc::Status const &)

Handle an RPC failure.

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

Parameter
Name Description
status grpc::Status const &
Returns
Type Description
bool

true if the RPC operation should be retried.