15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_OBJECT_WRITE_STREAM_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_OBJECT_WRITE_STREAM_H
18#include "google/cloud/storage/headers_map.h"
19#include "google/cloud/storage/internal/object_write_streambuf.h"
20#include "google/cloud/storage/version.h"
28GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
134
135
136
137
141
142
143
144
145
146
147
149 std::unique_ptr<internal::ObjectWriteStreambuf> buf);
160 basic_ostream<
char>::swap(rhs);
161 std::swap(buf_, rhs.buf_);
162 rhs.set_rdbuf(rhs.buf_.get());
163 set_rdbuf(buf_.get());
164 std::swap(metadata_, rhs.metadata_);
165 std::swap(headers_, rhs.headers_);
166 std::swap(payload_, rhs.payload_);
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192 bool IsOpen()
const {
return buf_ !=
nullptr && buf_->IsOpen(); }
195
196
197
198
199
200
201
202
203
204
205
206
207
208
213
214
215
216
217
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237 std::string
const&
received_hash()
const {
return buf_->received_hash(); }
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256 std::string
const&
computed_hash()
const {
return buf_->computed_hash(); }
259
260
261
262
263
264
265
266
267 HeadersMap
const&
headers()
const {
return headers_; }
270 std::string
const&
payload()
const {
return payload_; }
274
275
276
277
278
279
281 return buf_->resumable_session_id();
285
286
287
288
289
290
292 return buf_->next_expected_byte();
296
297
298
299
300
301
302
303
304
308
309
310
311
312
313
314
315
316
321
322
325 std::unique_ptr<internal::ObjectWriteStreambuf> buf_;
327 std::multimap<std::string, std::string> headers_;
328 std::string payload_;
331GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Defines a std::basic_ostream<char> to write to a GCS object.
Definition: object_write_stream.h:131
ObjectWriteStream & operator=(ObjectWriteStream const &)=delete
StatusOr< ObjectMetadata > const & metadata() const &
Access the upload results.
Definition: object_write_stream.h:218
Status last_status() const
Returns the status of partial errors.
Definition: object_write_stream.h:317
ObjectWriteStream()
Creates a stream not associated with any buffer.
StatusOr< ObjectMetadata > && metadata() &&
Access the upload results.
Definition: object_write_stream.h:219
~ObjectWriteStream() override
Closes the stream (if necessary).
ObjectWriteStream(ObjectWriteStream const &)=delete
ObjectWriteStream & operator=(ObjectWriteStream &&rhs) noexcept
Definition: object_write_stream.h:153
void Suspend() &&
Suspends an upload.
bool IsOpen() const
Return true if the stream is open to write more data.
Definition: object_write_stream.h:192
std::string const & received_hash() const
The received CRC32C checksum and the MD5 hash values as reported by GCS.
Definition: object_write_stream.h:237
std::uint64_t next_expected_byte() const
Returns the next expected byte.
Definition: object_write_stream.h:291
ObjectWriteStream(ObjectWriteStream &&rhs) noexcept
void swap(ObjectWriteStream &rhs)
Definition: object_write_stream.h:159
std::string const & computed_hash() const
The locally computed checksum and hashes, as a string.
Definition: object_write_stream.h:256
std::string const & resumable_session_id() const
Returns the resumable upload session id for this upload.
Definition: object_write_stream.h:280
void Close()
Close the stream, finalizing the upload.
ObjectWriteStream(std::unique_ptr< internal::ObjectWriteStreambuf > buf)
Creates a stream associated with the give request.
std::string const & payload() const
The returned payload as a raw string, for debugging only.
Definition: object_write_stream.h:270
HeadersMap const & headers() const
The headers (if any) returned by the service.
Definition: object_write_stream.h:267
Contains all the Google Cloud Storage C++ client APIs.
Definition: auto_finalize.h:24