Skip to content

Commit 8d73712

Browse files
committed
rebase with main branch
1 parent fc97e04 commit 8d73712

7 files changed

Lines changed: 38 additions & 29 deletions

google/cloud/storage/examples/storage_async_samples.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,10 +690,10 @@ void CreateAndWriteAppendableObject(google::cloud::storage::AsyncClient& client,
690690
auto coro = [](gcs::AsyncClient& client, std::string bucket_name,
691691
std::string object_name)
692692
-> google::cloud::future<google::storage::v2::Object> {
693-
auto [writer, token] = (co_await client.StartAppendableObjectUpload(
694-
gcs::BucketName(std::move(bucket_name)),
695-
std::move(object_name)))
696-
.value();
693+
auto [writer, token] =
694+
(co_await client.StartAppendableObjectUpload(
695+
gcs::BucketName(std::move(bucket_name)), std::move(object_name)))
696+
.value();
697697
std::cout << "Appendable upload started for object " << object_name << "\n";
698698

699699
token = (co_await writer.Write(std::move(token),

google/cloud/storage/examples/storage_otel_samples.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ void InstrumentedClient(std::vector<std::string> const& argv) {
4141
}
4242
//! [instrumented-client]
4343
namespace gc = ::google::cloud;
44+
namespace gcs = ::google::cloud::storage;
4445
[](std::string const& project_id, std::string const& bucket_name,
4546
std::string const& object_name) {
4647
auto configuration =

google/cloud/storage/internal/async/object_descriptor_impl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
3838

3939
struct ReadStream : public storage_internal::StreamBase {
4040
ReadStream(std::shared_ptr<OpenStream> stream,
41-
std::unique_ptr<storage_experimental::ResumePolicy> resume_policy)
41+
std::unique_ptr<storage::ResumePolicy> resume_policy)
4242
: stream(std::move(stream)), resume_policy(std::move(resume_policy)) {}
4343

4444
void Cancel() override {
4545
if (stream) stream->Cancel();
4646
}
4747

4848
std::shared_ptr<OpenStream> stream;
49-
std::unique_ptr<storage_experimental::ResumePolicy> resume_policy;
49+
std::unique_ptr<storage::ResumePolicy> resume_policy;
5050
google::storage::v2::BidiReadObjectRequest next_request;
5151
bool write_pending = false;
5252
bool read_pending = false;

google/cloud/storage/internal/async/object_descriptor_impl_test.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,7 @@ TEST(ObjectDescriptorImpl, MakeSubsequentStreamReusesAndMovesIdleStream) {
15771577
auto r1f1 = reader1->Read();
15781578
read1_1.first.set_value(true);
15791579
// read1_2/read1_3 completed via ready futures; no sequencer pops needed.
1580-
ASSERT_THAT(r1f1.get(), VariantWith<storage_experimental::ReadPayload>(_));
1580+
ASSERT_THAT(r1f1.get(), VariantWith<storage::ReadPayload>(_));
15811581
auto r1f2 = reader1->Read();
15821582
ASSERT_THAT(r1f2.get(), VariantWith<Status>(IsOk()));
15831583

@@ -1601,8 +1601,11 @@ TEST(ObjectDescriptorImpl, OnResumeSuccessful) {
16011601
e2.first.set_value(true); // Allow factory to proceed
16021602
} else {
16031603
ADD_FAILURE() << "Got unexpected events: " << e1.second << ", "
1604-
});
1604+
<< e2.second;
1605+
}
1606+
};
16051607

1608+
auto stream1 = std::make_unique<MockStream>();
16061609
// To keep Stream 1 alive during startup, the first Read returns a valid
16071610
// (empty) response. Subsequent reads return nullopt to trigger the
16081611
// Finish/Resume logic.
@@ -1648,8 +1651,8 @@ TEST(ObjectDescriptorImpl, OnResumeSuccessful) {
16481651
});
16491652

16501653
auto tested = std::make_shared<ObjectDescriptorImpl>(
1651-
storage_experimental::LimitedErrorCountResumePolicy(1)(),
1652-
factory.AsStdFunction(), google::storage::v2::BidiReadObjectSpec{},
1654+
storage::LimitedErrorCountResumePolicy(1)(), factory.AsStdFunction(),
1655+
google::storage::v2::BidiReadObjectSpec{},
16531656
std::make_shared<OpenStream>(std::move(stream1)));
16541657

16551658
tested->Start(Response{});

google/cloud/storage/internal/async/writer_connection_buffered.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class AsyncWriterConnectionBufferedState
117117
return std::move(finalized_future_);
118118
}
119119

120-
future<Status> Flush(storage_experimental::WritePayload const& p) {
120+
future<Status> Flush(storage::WritePayload const& p) {
121121
std::unique_lock<std::mutex> lk(mu_);
122122
// Create a new promise for this flush operation.
123123
promise<Status> current_flush_promise;
@@ -224,7 +224,7 @@ class AsyncWriterConnectionBufferedState
224224
auto impl = Impl(lk);
225225
lk.unlock();
226226
// Finalize with an empty payload.
227-
(void)impl->Finalize(storage_experimental::WritePayload{})
227+
(void)impl->Finalize(storage::WritePayload{})
228228
.then([w = WeakFromThis()](auto f) {
229229
if (auto self = w.lock()) return self->OnFinalize(f.get());
230230
});
@@ -341,8 +341,7 @@ class AsyncWriterConnectionBufferedState
341341

342342
void OnResume(
343343
Status const& original_status, bool was_finalizing,
344-
StatusOr<std::unique_ptr<storage_experimental::AsyncWriterConnection>>
345-
impl) {
344+
StatusOr<std::unique_ptr<storage::AsyncWriterConnection>> impl) {
346345
std::unique_lock<std::mutex> lk(mu_);
347346

348347
// Resume was *not* triggered by finalization failure.
@@ -631,8 +630,11 @@ class AsyncWriterConnectionBuffered : public storage::AsyncWriterConnection {
631630
return state_->Finalize(std::move(p));
632631
}
633632

634-
future<Status> Flush(storage_experimental::WritePayload p) override {
633+
future<Status> Flush(storage::WritePayload p) override {
635634
return state_->Flush(std::move(p));
635+
}
636+
637+
future<StatusOr<std::int64_t>> Query() override { return state_->Query(); }
636638

637639
RpcMetadata GetRequestMetadata() override {
638640
return state_->GetRequestMetadata();

google/cloud/storage/internal/async/writer_connection_buffered_test.cc

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ TEST(WriteConnectionBuffered, FinalizedOnResume) {
140140
auto resumed_mock = std::make_unique<MockAsyncWriterConnection>();
141141
EXPECT_CALL(*resumed_mock, PersistedState)
142142
.WillRepeatedly(Return(TestObject()));
143-
return make_status_or(
144-
std::unique_ptr<AsyncWriterConnection>(std::move(resumed_mock)));
143+
return make_status_or(std::unique_ptr<storage::AsyncWriterConnection>(
144+
std::move(resumed_mock)));
145145
});
146146
});
147147

@@ -181,7 +181,8 @@ TEST(WriteConnectionBuffered, FinalizeFailsAndResumeFails) {
181181
MockFactory mock_factory;
182182
EXPECT_CALL(mock_factory, Call).WillOnce([&]() {
183183
return sequencer.PushBack("Retry").then([&](auto) {
184-
return StatusOr<std::unique_ptr<AsyncWriterConnection>>(resume_error);
184+
return StatusOr<std::unique_ptr<storage::AsyncWriterConnection>>(
185+
resume_error);
185186
});
186187
});
187188

@@ -205,7 +206,8 @@ TEST(WriteConnectionBuffered, FinalizeFailsAndResumeFails) {
205206

206207
TEST(WriteConnectionBuffered, WriteResumes) {
207208
AsyncSequencer<bool> sequencer;
208-
auto make_mock = [&sequencer]() -> std::unique_ptr<AsyncWriterConnection> {
209+
auto make_mock =
210+
[&sequencer]() -> std::unique_ptr<storage::AsyncWriterConnection> {
209211
auto mock = std::make_unique<MockAsyncWriterConnection>();
210212
EXPECT_CALL(*mock, UploadId).WillRepeatedly(Return("test-upload-id"));
211213
EXPECT_CALL(*mock, PersistedState)
@@ -417,7 +419,8 @@ TEST(WriteConnectionBuffered, ReconnectError) {
417419
MockFactory mock_factory;
418420
EXPECT_CALL(mock_factory, Call).Times(1).WillOnce([&sequencer] {
419421
return sequencer.PushBack("Retry").then([](auto) {
420-
return StatusOr<std::unique_ptr<AsyncWriterConnection>>(TransientError());
422+
return StatusOr<std::unique_ptr<storage::AsyncWriterConnection>>(
423+
TransientError());
421424
});
422425
});
423426

@@ -473,7 +476,7 @@ TEST(WriteConnectionBuffered, FinalizeSucceedsThenError) {
473476
// The resume attempt will fail permanently.
474477
EXPECT_CALL(mock_factory, Call).WillOnce([&] {
475478
return sequencer.PushBack("Resume").then(
476-
[](auto) -> StatusOr<std::unique_ptr<AsyncWriterConnection>> {
479+
[](auto) -> StatusOr<std::unique_ptr<storage::AsyncWriterConnection>> {
477480
return PermanentError();
478481
});
479482
});
@@ -740,7 +743,7 @@ TEST(WriteConnectionBuffered, ErrorFailsPendingFlushes) {
740743
// The implementation calls Resume on a permanent error.
741744
EXPECT_CALL(mock_factory, Call).WillOnce([&]() {
742745
return sequencer.PushBack("Resume").then(
743-
[&](auto) -> StatusOr<std::unique_ptr<AsyncWriterConnection>> {
746+
[&](auto) -> StatusOr<std::unique_ptr<storage::AsyncWriterConnection>> {
744747
return resume_error;
745748
});
746749
});
@@ -1129,7 +1132,7 @@ TEST(WriteConnectionBuffered, FinalizeFailsThenResumeFails) {
11291132
MockFactory mock_factory;
11301133
EXPECT_CALL(mock_factory, Call).WillOnce([&]() {
11311134
return sequencer.PushBack("Resume").then(
1132-
[&](auto) -> StatusOr<std::unique_ptr<AsyncWriterConnection>> {
1135+
[&](auto) -> StatusOr<std::unique_ptr<storage::AsyncWriterConnection>> {
11331136
return resume_error;
11341137
});
11351138
});
@@ -1177,8 +1180,8 @@ TEST(WriteConnectionBuffered,
11771180
auto resumed_mock = std::make_unique<MockAsyncWriterConnection>();
11781181
EXPECT_CALL(*resumed_mock, PersistedState)
11791182
.WillRepeatedly(Return(MakePersistedState(0)));
1180-
return make_status_or(
1181-
std::unique_ptr<AsyncWriterConnection>(std::move(resumed_mock)));
1183+
return make_status_or(std::unique_ptr<storage::AsyncWriterConnection>(
1184+
std::move(resumed_mock)));
11821185
});
11831186
});
11841187

@@ -1228,11 +1231,11 @@ TEST(WriteConnectionBuffered, SetFinalizedIsIdempotent) {
12281231
// The resume attempt will discover the object is already finalized.
12291232
EXPECT_CALL(mock_factory, Call).WillOnce([&] {
12301233
return sequencer.PushBack("Resume").then(
1231-
[](auto) -> StatusOr<std::unique_ptr<AsyncWriterConnection>> {
1234+
[](auto) -> StatusOr<std::unique_ptr<storage::AsyncWriterConnection>> {
12321235
auto resumed_mock = std::make_unique<MockAsyncWriterConnection>();
12331236
EXPECT_CALL(*resumed_mock, PersistedState)
12341237
.WillRepeatedly(Return(TestObject()));
1235-
return std::unique_ptr<AsyncWriterConnection>(
1238+
return std::unique_ptr<storage::AsyncWriterConnection>(
12361239
std::move(resumed_mock));
12371240
});
12381241
});

google/cloud/storage/tests/async_client_integration_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,8 +1006,8 @@ TEST_F(AsyncClientIntegrationTest, Open) {
10061006

10071007
TEST_F(AsyncClientIntegrationTest, OpenExceedMaximumRange) {
10081008
if (!UsingEmulator()) GTEST_SKIP();
1009-
auto async = AsyncClient(
1010-
TestOptions().set<storage::MaximumRangeSizeOption>(1024));
1009+
auto async =
1010+
AsyncClient(TestOptions().set<storage::MaximumRangeSizeOption>(1024));
10111011
auto client = MakeIntegrationTestClient(true, TestOptions());
10121012
auto object_name = MakeRandomObjectName();
10131013

0 commit comments

Comments
 (0)