-
Notifications
You must be signed in to change notification settings - Fork 378
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
add storage support for per-operation options #7691
Comments
Note: The options stored in the client class should now include the
|
Addendum: Please also ensure that the |
In #8462 I create an |
BackgroundAll operations in the storage library already have a parameter pack: google-cloud-cpp/google/cloud/storage/client.h Lines 1114 to 1117 in 5cb5386
There are several alternatives to add Alternative 1 (my proposal)Support passing template <typename... Options>
StatusOr<ObjectMetadata> GetObjectMetadata(std::string const& bucket_name,
std::string const& object_name,
Options&&... options) {
internal::GetObjectMetadataRequest request(bucket_name, object_name);
// any `options` of type `::google::cloud::Options` are ignored here.
request.set_multiple_options(std::forward<Options>(options)...);
OptionSpan span(MergeWithRequestOptions(options_, std::forward<Options>(options)...);
return raw_client_->GetObjectMetadata(request);
} where
Alternative 2Convert all things we pass in parameter packs to be Alternative 3Try to consume all the |
I am going to exclude the standalone functions and postpone that work to #9211 |
Add an
Options options = {}
argument to the constructor of the client class(es). Merge these options with the default options for the service, and store them as a member of the client class.Add an
Options options = {}
argument to each operation within each client. These options should then be merged with the client options from above, and installed as the prevailing options for the duration of the operation by instantiating aninternal::OptionsSpan
.You could then use
internal::CurrentOptions()
to obtain (aconst&
to) the prevailing options from anywhere you might need them. Any cleanup for call paths whereOptions
have been passed explicitly is discretionary.Similar support for the generated client classes was added in #7683, so you might be able to use that as an example.
I (@coryan) will steal some of the description to break down the work a bit.
storage::internal::*Request
classes to ignoregoogle::cloud::Options
inset_multiple_options()
google::cloud::Options
and to create spansstorage::Client
to create anOptionsSpan
storage::internal::CurlClient
to usegoogle::cloud::internal::CurrentOptions()
storage::internal::RetryClient
to usegoogle::cloud::internal::CurrentOptions()
storage::internal::GrpcClient
to stop creating its own spansstorage::internal::RestClient
to usegoogle::cloud::internal::CurrentOptions()
storage::Client
The text was updated successfully, but these errors were encountered: