Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified ci/abi-dumps/google_cloud_cpp_storage.expected.abi.dump.gz
Binary file not shown.
Binary file modified ci/abi-dumps/google_cloud_cpp_storage_grpc.expected.abi.dump.gz
Binary file not shown.
65 changes: 0 additions & 65 deletions doc/v3-migration-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -555,71 +555,6 @@ void CreateClient() {

</details>

<details>
<summary>Removed <code>Client(Connection, NoDecorations)</code> constructor</summary>

The `Client` constructor that accepted a `StorageConnection` and the
`NoDecorations` tag has been removed. This was intended only for test code.

**Before:**

```cpp
#include "google/cloud/storage/client.h"
#include "google/cloud/storage/testing/mock_storage_connection.h"

void TestClient() {
auto mock = std::make_shared<google::cloud::storage::testing::MockStorageConnection>();
// ...
auto client = google::cloud::storage::Client(
mock, google::cloud::storage::Client::NoDecorations{});
}
```

**After:**

```cpp
#include "google/cloud/storage/client.h"
#include "google/cloud/storage/testing/mock_storage_connection.h"

void TestClient() {
auto mock = std::make_shared<google::cloud::storage::testing::MockStorageConnection>();
// ...
auto client = google::cloud::storage::internal::ClientImplDetails::CreateWithoutDecorations(mock);
}
```

</details>

<details>
<summary>Removed <code>Client::raw_client()</code></summary>

The `Client::raw_client()` method has been removed. This was intended only for
internal use or testing. If you need access to the underlying connection for
testing purposes, use `google::cloud::storage::internal::ClientImplDetails`.

**Before:**

```cpp
#include "google/cloud/storage/client.h"

void UseRawClient(google::cloud::storage::Client client) {
auto connection = client.raw_client();
}
```

**After:**

```cpp
#include "google/cloud/storage/client.h"

void UseRawClient(google::cloud::storage::Client client) {
auto connection =
google::cloud::storage::internal::ClientImplDetails::GetConnection(client);
}
```

</details>

### IAM

<details>
Expand Down
21 changes: 21 additions & 0 deletions google/cloud/storage/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -3441,6 +3441,27 @@ class Client {
/// Define a tag to disable automatic decorations of the StorageConnection.
struct NoDecorations {};

/// Builds a client with a specific StorageConnection, without decorations.
/// @deprecated This was intended only for test code, applications should not
/// use it.
GOOGLE_CLOUD_CPP_DEPRECATED(
"applications should not need this."
" Please file a bug at https://github.com/googleapis/google-cloud-cpp"
" if you do.")
explicit Client(std::shared_ptr<internal::StorageConnection> connection,
NoDecorations)
: Client(InternalOnlyNoDecorations{}, std::move(connection)) {}

/// Access the underlying `StorageConnection`.
/// @deprecated Only intended for implementors, do not use.
GOOGLE_CLOUD_CPP_DEPRECATED(
"applications should not need this."
" Please file a bug at https://github.com/googleapis/google-cloud-cpp"
" if you do.")
std::shared_ptr<internal::StorageConnection> raw_client() const {
return connection_;
}

private:
friend class internal::NonResumableParallelUploadState;
friend class internal::ResumableParallelUploadState;
Expand Down
6 changes: 3 additions & 3 deletions google/cloud/storage/grpc_plugin_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ TEST(GrpcPluginTest, HybridUsesGrpcBufferOptions) {
ScopedEnvironment("GOOGLE_CLOUD_CPP_STORAGE_GRPC_CONFIG", absl::nullopt);
auto client = MakeGrpcClient(
TestOptions().set<storage_experimental::GrpcPluginOption>("media"));
auto connection = ClientImplDetails::GetConnection(client);
EXPECT_GE(connection->options().get<storage::UploadBufferSizeOption>(),
32 * 1024 * 1024UL);
EXPECT_GE(
client.raw_client()->options().get<storage::UploadBufferSizeOption>(),
32 * 1024 * 1024L);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To avoid potential compiler warnings about signed/unsigned integer comparisons, it's better to use an unsigned literal for the expected buffer size. The UploadBufferSizeOption has a type of std::size_t, which is unsigned. The literal 32 * 1024 * 1024L has type long (signed). The code being replaced in this revert correctly used UL for an unsigned long.

      32 * 1024 * 1024UL);

}

TEST(GrpcPluginTest, BackwardsCompatibilityShims) {
Expand Down
Loading