17
17
18
18
#include " google/cloud/storage/async/bucket_name.h"
19
19
#include " google/cloud/storage/async/connection.h"
20
+ #include " google/cloud/storage/async/object_descriptor.h"
20
21
#include " google/cloud/storage/async/reader.h"
21
22
#include " google/cloud/storage/async/rewriter.h"
22
23
#include " google/cloud/storage/async/token.h"
@@ -231,6 +232,41 @@ class AsyncClient {
231
232
google::storage::v2::WriteObjectRequest request, WritePayload contents,
232
233
Options opts = {});
233
234
235
+ /* *
236
+ * Open an object descriptor to perform one or more ranged reads.
237
+ *
238
+ * @par Idempotency
239
+ * This is a read-only operation and is always idempotent. The operation will
240
+ * retry until the descriptor is successfully created. The descriptor itself
241
+ * will resume any incomplete ranged reads if the connection(s) are
242
+ * interrupted. Use `ResumePolicyOption` and `ResumePolicy` to control this.
243
+ *
244
+ * @param bucket_name the name of the bucket that contains the object.
245
+ * @param object_name the name of the object to be read.
246
+ * @param opts options controlling the behavior of this RPC, for example
247
+ * the application may change the retry policy.
248
+ */
249
+ future<StatusOr<ObjectDescriptor>> Open (BucketName const & bucket_name,
250
+ std::string object_name,
251
+ Options opts = {});
252
+
253
+ /* *
254
+ * Open an object descriptor to perform one or more ranged reads.
255
+ *
256
+ * @par Idempotency
257
+ * This is a read-only operation and is always idempotent. The operation will
258
+ * retry until the descriptor is successfully created. The descriptor itself
259
+ * will resume any incomplete ranged reads if the connection(s) are
260
+ * interrupted. Use `ResumePolicyOption` and `ResumePolicy` to control this.
261
+ *
262
+ * @param spec the BidiReadObjectSpec to use when retrieving the
263
+ * ObjectDescriptor.
264
+ * @param opts options controlling the behavior of this RPC, for example
265
+ * the application may change the retry policy.
266
+ */
267
+ future<StatusOr<ObjectDescriptor>> Open (
268
+ google::storage::v2::BidiReadObjectSpec spec, Options opts = {});
269
+
234
270
/* *
235
271
* A streaming download for the contents of an object.
236
272
*
@@ -243,7 +279,7 @@ class AsyncClient {
243
279
* @par Idempotency
244
280
* This is a read-only operation and is always idempotent. Once the download
245
281
* starts, this operation will automatically resume the download if is
246
- * interrupted. Use `ResumePolicyOption` and `ResumePolicy` to control this
282
+ * interrupted. Use `ResumePolicyOption` and `ResumePolicy` to control this.
247
283
*
248
284
* @param bucket_name the name of the bucket that contains the object.
249
285
* @param object_name the name of the object to be read.
@@ -334,10 +370,82 @@ class AsyncClient {
334
370
google::storage::v2::ReadObjectRequest request, std::int64_t offset,
335
371
std::int64_t limit, Options opts = {});
336
372
373
+ /*
374
+ [start-appendable-object-upload]
375
+ Initiates a [resumable upload][resumable-link] for an appendable object.
376
+
377
+ Appendable objects allow you to create an object and upload data to it
378
+ incrementally until it is finalized. This means you can start an upload
379
+ and append data to the object later.
380
+
381
+ You can finalize an appendable object in the first call itself by providing
382
+ all the data in the initial upload. You can also explicitly Flush to ensure
383
+ the data is persisted.
384
+
385
+ The recovery can be done from most transient errors, including an unexpected
386
+ closure of the streaming RPC used for the upload.
387
+
388
+ @par Example
389
+ @snippet storage_async_samples.cc start-appendable-object-upload
390
+
391
+ @par Idempotency
392
+ This function is always treated as idempotent, and the library will
393
+ automatically retry the function on transient errors.
394
+
395
+ [resumable-link]: https://cloud.google.com/storage/docs/resumable-uploads
396
+ [start-appendable-object-upload]
397
+ */
398
+
399
+ /* *
400
+ * Starts a new resumable upload session for appendable objects and
401
+ * automatic recovery from transient failures.
402
+ *
403
+ * @snippet{doc} async/client.h start-appendable-object-upload
404
+ *
405
+ * @param bucket_name the name of the bucket that contains the object.
406
+ * @param object_name the name of the object to be read.
407
+ * @param opts options controlling the behavior of this RPC, for example
408
+ * the application may change the retry policy.
409
+ */
410
+ future<StatusOr<std::pair<AsyncWriter, AsyncToken>>>
411
+ StartAppendableObjectUpload (BucketName const & bucket_name,
412
+ std::string object_name, Options opts = {});
413
+
414
+ /* *
415
+ * Starts a new resumable upload session for appendable objects and
416
+ * automatic recovery from transient failures.
417
+ *
418
+ * @snippet{doc} async/client.h start-appendable-object-upload
419
+ *
420
+ * @param request the request contents, it must include the bucket name and
421
+ * object names. Many other fields are optional.
422
+ * @param opts options controlling the behavior of this RPC, for example
423
+ * the application may change the retry policy.
424
+ */
425
+ future<StatusOr<std::pair<AsyncWriter, AsyncToken>>>
426
+ StartAppendableObjectUpload (
427
+ google::storage::v2::BidiWriteObjectRequest request, Options opts = {});
428
+
429
+ /* *
430
+ * Resume a resumable upload session for appendable objects and automatic
431
+ * recovery from transient failures.
432
+ *
433
+ * @param bucket_name the name of the bucket that contains the object.
434
+ * @param object_name the name of the object to be uploaded.
435
+ * @param generation the object generation to be uploaded.
436
+ * @param opts options controlling the behaviour of this RPC, for example the
437
+ * application may change the retry policy.
438
+ */
439
+ future<StatusOr<std::pair<AsyncWriter, AsyncToken>>>
440
+ ResumeAppendableObjectUpload (BucketName const & bucket_name,
441
+ std::string object_name, std::int64_t generation,
442
+ Options opts = {});
443
+
337
444
/*
338
445
[start-buffered-upload-common]
339
446
This function always uses [resumable uploads][resumable-link]. The objects
340
447
returned by this function buffer data until it is persisted on the service.
448
+
341
449
If the buffer becomes full, they stop accepting new data until the service
342
450
has persisted enough data.
343
451
0 commit comments