Google Cloud Storage C++ Client 2.13.0
A C++ Client Library for Google Cloud Storage
Loading...
Searching...
No Matches
async_object_responses.h
1// Copyright 2022 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_ASYNC_OBJECT_RESPONSES_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_ASYNC_OBJECT_RESPONSES_H
17
18#include "google/cloud/storage/object_metadata.h"
19#include "google/cloud/storage/version.h"
20#include "absl/types/optional.h"
21#include <cstdint>
22#include <map>
23#include <string>
24#include <vector>
25
26namespace google {
27namespace cloud {
28namespace storage_experimental {
29GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
30
31/// Represents the response from reading a subset of an object.
33 /**
34 * The final status of the download.
35 *
36 * Downloads can have partial failures, where only a subset of the data is
37 * successfully downloaded, and then the connection is interrupted. With the
38 * default configuration, the client library resumes the download. If,
39 * however, the `storage::RetryPolicy` is exhausted, only the partial results
40 * are returned, and the last error status is returned here.
41 */
43
44 /// If available, the full object metadata.
45 absl::optional<storage::ObjectMetadata> object_metadata;
46
47 /**
48 * The object contents.
49 *
50 * The library receives the object contents as a sequence of `std::string`.
51 * To avoid copies the library returns the sequence to the application. If
52 * you need to consolidate the contents use something like:
53 *
54 * @code
55 * AsyncReadObjectRangeResponse response = ...;
56 * auto all = std::accumulate(
57 * response.contents.begin(), response.contents.end(), std::string{},
58 * [](auto a, auto b) { a += b; return a; });
59 * @endcode
60 */
61 std::vector<std::string> contents;
62
63 /**
64 * Per-request metadata and annotations.
65 *
66 * These are intended as debugging tools. They are subject to change without
67 * notice.
68 */
69 std::multimap<std::string, std::string> request_metadata;
70};
71
72GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
73} // namespace storage_experimental
74} // namespace cloud
75} // namespace google
76
77#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_ASYNC_OBJECT_RESPONSES_H
Represents the metadata for a Google Cloud Storage Object.
Definition: object_metadata.h:94
Contains experimental features for the GCS C++ Client Library.
Definition: async_client.h:27
Contains all the Google Cloud Storage C++ client APIs.
Definition: auto_finalize.h:24
Represents the response from reading a subset of an object.
Definition: async_object_responses.h:32
absl::optional< storage::ObjectMetadata > object_metadata
If available, the full object metadata.
Definition: async_object_responses.h:45
std::multimap< std::string, std::string > request_metadata
Per-request metadata and annotations.
Definition: async_object_responses.h:69
Status status
The final status of the download.
Definition: async_object_responses.h:42
std::vector< std::string > contents
The object contents.
Definition: async_object_responses.h:61