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.
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.
std::enable_if_t<>< 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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-21 UTC."],[[["This webpage details the `ObjectRewriter` class, which is used to manage and complete long-running object rewrite operations in Google Cloud Storage."],["The `ObjectRewriter` class facilitates copying objects across location boundaries and rewriting objects with different encryption keys, potentially requiring multiple service calls."],["The `Iterate()` function allows for a single iteration of the rewrite process, while `Result()` and `ResultWithProgressCallback()` enable blocking operations until the copy is finished, with the latter providing a progress callback."],["Users can utilize `CurrentProgress()` to check on the state of the rewrite and `token()` to save the current rewrite token, allowing for restarts of the operation even if the application has stopped, as long as they also save the required information."],["The documentation provides a reference for various versions of the `ObjectRewriter` class, going back to version 2.11.0 and up to the latest release candidate, 2.37.0-rc."]]],[]]