Namespace google::cloud::storage_experimental (2.13.0)

Contains experimental features for the GCS C++ Client Library.

Classes

AsyncClient

A client for Google Cloud Storage offering asynchronous operations.

Structs

AsyncReadObjectRangeResponse

Represents the response from reading a subset of an object.

GrpcPluginOption

Configure the GCS+gRPC plugin.

HttpVersionOption

Set the HTTP version used by the client.

Functions

MakeAsyncClient(Options)

Creates a new GCS client exposing asynchronous APIs.

Parameter
Name Description
opts
Returns
Type Description
AsyncClient

DefaultGrpcClient(Options)

Create a google::cloud::storage::Client object configured to use gRPC.

Example
void GrpcReadWrite(std::string const& bucket_name) {
  namespace gcs = ::google::cloud::storage;
  auto constexpr kText = R"""(Hello World!)""";

  auto client = google::cloud::storage_experimental::DefaultGrpcClient();

  auto object = client.InsertObject(bucket_name, "lorem.txt", kText);
  if (!object) throw std::move(object).status();

  auto input = client.ReadObject(bucket_name, "lorem.txt",
                                 gcs::Generation(object->generation()));
  std::string const actual(std::istreambuf_iterator<char>{input}, {});
  std::cout << "The contents read back are:\n"
            << actual
            << "\nThe received checksums are: " << input.received_hash()
            << "\nThe computed checksums are: " << input.computed_hash()
            << "\nThe original hashes    are: crc32c=" << object->crc32c()
            << ",md5=" << object->md5_hash() << "\n";
}
Parameter
Name Description
opts

the configuration parameters for the Client.

Returns
Type Description
google::cloud::storage::Client