Skip to content

Commit 49fa97f

Browse files
committed
refactor: Consolidate AsyncWriter creation logic and reuse ResumeAppendableObjectUpload overload.
1 parent 3d93e58 commit 49fa97f

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

google/cloud/storage/async/client.cc

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,7 @@ AsyncClient::ResumeAppendableObjectUpload(BucketName const& bucket_name,
153153
append_object_spec.set_object(std::move(object_name));
154154
append_object_spec.set_generation(generation);
155155

156-
return connection_
157-
->ResumeAppendableObjectUpload(
158-
{std::move(request),
159-
internal::MergeOptions(std::move(opts), connection_->options())})
160-
.then([](auto f) -> StatusOr<std::pair<AsyncWriter, AsyncToken>> {
161-
auto w = f.get();
162-
if (!w) return std::move(w).status();
163-
auto t = storage_internal::MakeAsyncToken(w->get());
164-
return std::make_pair(AsyncWriter(*std::move(w)), std::move(t));
165-
});
156+
return ResumeAppendableObjectUpload(std::move(request), std::move(opts));
166157
}
167158

168159
future<StatusOr<std::pair<AsyncWriter, AsyncToken>>>

google/cloud/storage/async/client.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ class AsyncClient {
432432
* @param bucket_name the name of the bucket that contains the object.
433433
* @param object_name the name of the object to be uploaded.
434434
* @param generation the object generation to be uploaded.
435-
* @param opts options controlling the behaviour of this RPC, for example the
435+
* @param opts options controlling the behavior of this RPC, for example the
436436
* application may change the retry policy.
437437
*/
438438
future<StatusOr<std::pair<AsyncWriter, AsyncToken>>>
@@ -446,7 +446,7 @@ class AsyncClient {
446446
*
447447
* @param request the request contents, it must include the bucket name,
448448
* object name, and generation. Many other fields are optional.
449-
* @param opts options controlling the behaviour of this RPC, for example the
449+
* @param opts options controlling the behavior of this RPC, for example the
450450
* application may change the retry policy.
451451
*/
452452
future<StatusOr<std::pair<AsyncWriter, AsyncToken>>>

0 commit comments

Comments
 (0)