Skip to content

feat(google_cloud_storage): implement moveObject support#215

Open
sigurdm wants to merge 3 commits intogoogleapis:mainfrom
sigurdm:object_move
Open

feat(google_cloud_storage): implement moveObject support#215
sigurdm wants to merge 3 commits intogoogleapis:mainfrom
sigurdm:object_move

Conversation

@sigurdm
Copy link
Copy Markdown

@sigurdm sigurdm commented Mar 24, 2026

Fixes #195

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request successfully implements the moveObject functionality, adding both a top-level method in Storage and a convenience method in StorageObject. The implementation correctly constructs the API request URL and handles conditional parameters for idempotency as described in the Google Cloud Storage API documentation. The new test file move_object_test.dart provides comprehensive coverage, including success cases, StorageObject usage, conditional failure, and thorough mock request verification. The code adheres to good Dart practices, is well-documented, and integrates seamlessly with the existing library structure. No specific issues or critical improvement opportunities were identified in the changes.

@brianquinlan
Copy link
Copy Markdown
Contributor

/gcbrun

@brianquinlan
Copy link
Copy Markdown
Contributor

Hmmm...why didn't /gcbrun trigger the GCB?

Copy link
Copy Markdown
Contributor

@brianquinlan brianquinlan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Holy crap you did this quicky!

I'm not sure why the GCB tests aren't running. I would have thought that they'd run automatically for you. And I can't seem to manually trigger them.

///
/// If set, [ifGenerationMatch] makes the operation conditional on whether
/// the destination object's current generation matches the given value.
/// A value of `0` indicates that the destination object must not already
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// A value of `0` indicates that the destination object must not already
/// A value of `BigInt.zero` indicates that the destination object must not already


/// Moves this [Google Cloud Storage object][] to a new [newName].
///
/// This operation is atomic and idempotent if [ifSourceGenerationMatch] or
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that true? My intuition would be that both have to be set.

);

expect(moved.name, 'dest.txt');
expect(moved.bucket, bucketName);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe check that the metageneration is 1?

});
});

test('mock request verification', () async {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually use mocks to test retries. Do you think those tests have value? I'm not sure.

@brianquinlan
Copy link
Copy Markdown
Contributor

/gcbrun

@brianquinlan
Copy link
Copy Markdown
Contributor

Now "/gcbrun" is working - maybe there was some transient infrastructure problem?

@sigurdm sigurdm changed the title Implement support for moveObject feat(google_cloud_storage): implement moveObject support Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support renaming objects atomically

2 participants