15 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_POLLING_POLICY_H 16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_POLLING_POLICY_H 57 virtual std::unique_ptr<PollingPolicy> clone()
const = 0;
68 virtual bool OnFailure(google::cloud::Status
const& status) = 0;
73 virtual std::chrono::milliseconds WaitPeriod() = 0;
84 : retry_policy_(std::move(retry_policy)),
85 backoff_policy_(std::move(backoff_policy)) {}
88 std::unique_ptr<PollingPolicy>
clone()
const override {
92 bool OnFailure(google::cloud::Status
const& status)
override {
93 return retry_policy_.OnFailure(status);
97 return backoff_policy_.OnCompletion();
103 Backoff backoff_policy_;
111 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_POLLING_POLICY_H GenericPollingPolicy(Retry retry_policy, Backoff backoff_policy)
std::unique_ptr< PollingPolicy > clone() const override
Return a copy of the current policy.
Control the Cloud Spanner C++ client library behavior with respect to polling on long running operati...
Contains all the Cloud Spanner C++ client types and functions.
Combine a RetryPolicy and a BackoffPolicy to create simple polling policies.
google::cloud::internal::LimitedTimeRetryPolicy< google::cloud::Status, internal::SafeGrpcRetry > LimitedTimeRetryPolicy
A retry policy that limits based on time.
google::cloud::internal::ExponentialBackoffPolicy ExponentialBackoffPolicy
A truncated exponential backoff policy with randomized periods.
bool OnFailure(google::cloud::Status const &status) override
A callback to indicate that a polling attempt failed.
#define SPANNER_CLIENT_NS
std::chrono::milliseconds WaitPeriod() override
How long should the polling loop wait before trying again.