diff --git a/google/cloud/storage/async/client.cc b/google/cloud/storage/async/client.cc index 509b6294a7a96..f644592fa5455 100644 --- a/google/cloud/storage/async/client.cc +++ b/google/cloud/storage/async/client.cc @@ -52,6 +52,7 @@ future> AsyncClient::InsertObject( future> AsyncClient::Open( BucketName const& bucket_name, std::string object_name, Options opts) { auto spec = google::storage::v2::BidiReadObjectSpec{}; + std::cerr << "Hey this is a test statement of new branch.\n"; spec.set_bucket(bucket_name.FullName()); spec.set_object(std::move(object_name)); return Open(std::move(spec), std::move(opts)); @@ -59,7 +60,8 @@ future> AsyncClient::Open( future> AsyncClient::Open( google::storage::v2::BidiReadObjectSpec spec, Options opts) { - return connection_ + std::cerr << "Hey this is a test statement of new branch.\n"; + return connection_ ->Open({std::move(spec), internal::MergeOptions(std::move(opts), connection_->options())}) .then([](auto f) -> StatusOr { @@ -116,7 +118,8 @@ future>> AsyncClient::StartAppendableObjectUpload(BucketName const& bucket_name, std::string object_name, Options opts) { - auto request = google::storage::v2::BidiWriteObjectRequest{}; + std::cerr << "Hey this is a test statement of new branch.\n"; + auto request = google::storage::v2::BidiWriteObjectRequest{}; auto& resource = *request.mutable_write_object_spec()->mutable_resource(); resource.set_bucket(BucketName(bucket_name).FullName()); @@ -129,7 +132,11 @@ AsyncClient::StartAppendableObjectUpload(BucketName const& bucket_name, future>> AsyncClient::StartAppendableObjectUpload( google::storage::v2::BidiWriteObjectRequest request, Options opts) { - return connection_ + std::cerr << "Hey this is a test statement of new branch.\n"; + return make_ready_future( + StatusOr>(Status( + StatusCode::kInternal, "msg"))); + return connection_ ->StartAppendableObjectUpload( {std::move(request), internal::MergeOptions(std::move(opts), connection_->options())}) diff --git a/google/cloud/storage/internal/async/writer_connection_resumed.cc b/google/cloud/storage/internal/async/writer_connection_resumed.cc index 3f467d0ed7eb3..ebae1267878e5 100644 --- a/google/cloud/storage/internal/async/writer_connection_resumed.cc +++ b/google/cloud/storage/internal/async/writer_connection_resumed.cc @@ -113,7 +113,7 @@ class AsyncWriterConnectionResumedState resend_buffer_.Append(WritePayloadImpl::GetImpl(p)); finalize_ = true; HandleNewData(std::move(lk)); - // Return the unique future associated with this finalization. + // Returns the unique future associated with this finalization. return std::move(finalized_future_); } @@ -184,6 +184,7 @@ class AsyncWriterConnectionResumedState } void WriteLoop(std::unique_lock lk) { + std::cerr << "Hey this is a test statement of new branch.\n"; // Determine if there's data left to write *before* potentially finalizing. writing_ = write_offset_ < resend_buffer_.size(); @@ -256,8 +257,8 @@ class AsyncWriterConnectionResumedState auto impl = Impl(lk); lk.unlock(); impl->Query().then([this, result, w = WeakFromThis()](auto f) { - SetFlushed(std::unique_lock(mu_), std::move(result)); if (auto self = w.lock()) return self->OnQuery(f.get()); + SetFlushed(std::unique_lock(mu_), std::move(result)); }); } @@ -463,8 +464,8 @@ class AsyncWriterConnectionResumedState flushed.set_value(result); // Restart the write loop ONLY if we are not already finalizing. // If finalizing_ is true, the completion will be handled by OnFinalize. - std::unique_lock loop_lk(mu_); - if (!finalizing_) WriteLoop(std::move(loop_lk)); + // std::unique_lock loop_lk(mu_); + // if (!finalizing_) WriteLoop(std::move(loop_lk)); } void SetError(std::unique_lock lk, Status const& status) {