-
Notifications
You must be signed in to change notification settings - Fork 366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We should release our policy types #9434
Labels
type: cleanup
An internal cleanup or hygiene concern.
Comments
Consider this for 2023/Q1. |
One alternative is to just generate: class AccessApprovalRetryPolicy : public google::internal::.... {
public:
/// Pretty explanations for Doxygen and friends.
bool OnFailure(Status const& ...) override { return Base::OnFailure(...); }
}; and then manually do the same for the hand-crafted libraries. We probably need to write a one pager. |
We decided to implement something along these lines: struct EkmServiceRetryPolicy : public google::cloud::RetryPolicy {
public:
/// Documented expectations for this function go here
virtual std::unique_ptr<EkmServiceRetryPolicy> clone() const = 0;
};
class EkmServiceLimitedTimeRetryPolicy : public EkmServiceRetryPolicy {
public:
explicit LimitedErrorCountRetryPolicy(int maximum_failures)
: impl_(maximum_failures) {}
std::unique_ptr<EkmServiceRetryPolicy> clone() const override {
return std::make_unique<EkmServiceLimitedTimeRetryPolicy>(impl_.maximum_failures());
}
bool OnFailure(Status const& s) override { return impl_.OnFailure(s); }
bool IsExhausted() const override { return impl_.IsExhausted(); }
bool IsPermanentFailure(Status const& s) const override {
return impl_.IsPermanentFailure(s);
}
private:
google::cloud::internal::LimitedTimeRetryPolicy<
kms_v1_internal::EkmServiceRetryTraits> impl_;
};
class EkmServiceLimitedErrorCountRetryPolicy : public EkmServiceRetryPolicy {
// Same idea as above. |
This was referenced Jul 5, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We define policy types like this:
google-cloud-cpp/google/cloud/accessapproval/access_approval_connection.h
Lines 37 to 39 in 8a2efcf
This is in violation of https://github.com/googleapis/google-cloud-cpp/blob/main/doc/adr/2022-01-21-only-public-types-in-public-APIs.md
There is no way to learn the interface of this type, other than by looking at the code. (Doxygen does not generate documentation for
internal::TraitBasedRetryPolicy<T>
)To allow for customer-defined retry policies, I think we need to release
RetryPolicy
andTraitBasedRetryPolicy
.The text was updated successfully, but these errors were encountered: