Class ObjectRewriter (2.14.0)

Complete long running object rewrite operations.

The Client::RewriteObject() operation allows applications to copy objects across location boundaries, and to rewrite objects with different encryption keys. In some circumstances it may take multiple calls to the service to complete a rewrite, this class encapsulates the state of a partial copy.

Constructors

ObjectRewriter(std::shared_ptr< internal::RawClient >, internal::RewriteObjectRequest)

Parameters
Name Description
client std::shared_ptr< internal::RawClient >
request internal::RewriteObjectRequest

Functions

Iterate()

Perform one iteration in the rewrite.

Returns
Type Description
StatusOr< RewriteProgress >

The progress after the iteration. If the rewrite has completed the application can use Result() to examine the metadata for the newly created object.

CurrentProgress() const

The current progress on the rewrite operation.

Returns
Type Description
StatusOr< RewriteProgress >

Result()

Iterate until the operation completes using a callback to report progress.

Returns
Type Description
StatusOr< ObjectMetadata >

the object metadata once the copy completes.

ResultWithProgressCallback(Functor)

Iterate until the operation completes using a callback to report progress.

Parameters
Name Description
cb Functor

the callback object.

typename Functor

the type of the callback object. It must satisfy: std:is_invocable<Functor,StatusOr<RewriteProgress>>:: value == true.

typename std::enable_if<>< functor,="">
Returns
Type Description
StatusOr< ObjectMetadata >

the object metadata once the copy completes.

token() const

The current rewrite token.

Applications can save the token of partially completed rewrites, and restart those operations using Client::CopyObjectRestart, even if the application has terminated. It is up to the application to preserve all the other information for the request, including source and destination buckets, encryption keys, and any preconditions affecting the request.

Returns
Type Description
std::string const &