GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Storage] Bucket lock samples and bug fixes. by frankyn · Pull Request #3709 · googleapis/google-cloud-java

Conversation

@frankyn

@frankyn frankyn commented Sep 20, 2018 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Bug fixes from sample review

  • Clean up comments for Boolean types in the Storage client library to explain possible states.
  • Fix Integration tests that kept failing due to objects with retention by releasing holds during cleanup.
  • Fix bug in client library not allowing to clear retentionPolicy correctly.
  • Be consistent with how Booleans are handled between Bucket and Blob classes.
  • Reformat BlobInfo and BucketInfo classes.

Samples

  • Update storage snippets bucket clean up to follow integration tests.
  • Define a retention policy
  • Remove a retention policy if not locked
  • Lock a retention policy
  • Set temporary hold
  • Release temporary hold
  • Set event-based hold
  • Release event-based hold
  • Set default event-based hold
  • Release default event-based hold
  • View default event-based hold
  • View bucket retention policy metadata
  • View metadata for object
  • Run formatter.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Frank Natividad added 2 commits September 20, 2018 12:29
Frank Natividad
Fix issue in tests, write bucket lock samples, and resolve issue in c…
5c3a5e1
…lient library
Frank Natividad
Update documentation around Boolean returns to clarify different retu…
c5cafd7
…rn caes.
@frankyn
frankyn requested review from kurtisvg and pongad September 20, 2018 20:30
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 20, 2018
Frank Natividad
Fix broken unit test
6235c62
kurtisvg
kurtisvg suggested changes Sep 20, 2018
View reviewed changes
Comment thread ...google-cloud-storage/src/main/java/com/google/cloud/storage/testing/RemoteStorageHelper.java Outdated
for (Blob blob : bucket.list(BlobListOption.fields(Storage.BlobField.EVENT_BASED_HOLD,
Storage.BlobField.TEMPORARY_HOLD)).iterateAll()) {
if(blob.getEventBasedHold() == true || blob.getTemporaryHold() == true) {
BlobInfo.Builder blobBuilder = BlobInfo.newBuilder(bucket.getName(), blob.getName());

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...ud-clients/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITStorageTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/StorageSnippets.java Outdated
System.out.println("Last Metadata Update: " + new Date(blob.getUpdateTime()));
System.out.println(
"temporaryHold: "
+ (blob.getTemporaryHold() != null && blob.getTemporaryHold()

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/StorageSnippets.java Outdated
if (blob.getMetadata() != null) {
System.out.println("User metadata:");
for (Map.Entry<String, String> userMetadata : blob.getMetadata().entrySet()) {
System.out.println(userMetadata.getKey() + " " + userMetadata.getValue());

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/StorageSnippets.java Outdated
Bucket bucket = storage.get(bucketName, BucketGetOption.fields(BucketField.RETENTION_POLICY));
if (bucket.retentionPolicyIsLocked() != null && bucket.retentionPolicyIsLocked()) {
System.out.println("Unable to remove retention period as retention policy is locked.");
return bucket;

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/StorageSnippets.java Outdated
return bucket;
}

Bucket updated_bucket = bucket.toBuilder().setRetentionPeriod(null).build().update();

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/StorageSnippets.java Outdated
Bucket bucket = storage.get(bucketName, BucketGetOption.fields(BucketField.RETENTION_POLICY));

System.out.println("Retention Policy for " + bucketName);

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/StorageSnippets.java Outdated

Bucket bucket =
storage.get(bucketName, Storage.BucketGetOption.fields(BucketField.METAGENERATION));
Bucket updated_bucket =

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/StorageSnippets.java Outdated
Bucket bucket =
storage.get(bucketName, BucketGetOption.fields(BucketField.DEFAULT_EVENT_BASED_HOLD));

if (bucket.getDefaultEventBasedHold() == true) {

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Comment thread ...oud-examples/src/test/java/com/google/cloud/examples/storage/snippets/ITStorageSnippets.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Frank Natividad
Address feedback
f0488f5
@frankyn

frankyn commented Sep 20, 2018

Copy link
Copy Markdown
Contributor Author

Comments addressed. @kurtisvg PTAL

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kurtisvg
kurtisvg approved these changes Sep 21, 2018
View reviewed changes

@kurtisvg kurtisvg left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pongad
pongad removed their request for review September 21, 2018 05:42
@frankyn

frankyn commented Sep 22, 2018

Copy link
Copy Markdown
Contributor Author

Merging for now and following up in a separate PR to resolve devex issues.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@frankyn
frankyn merged commit c55c3b7 into gcs-bucket-lock-ready Sep 22, 2018
@frankyn
frankyn deleted the gcs-bucket-lock-samples branch September 22, 2018 17:26
@frankyn frankyn mentioned this pull request Sep 25, 2018
[Storage] Bucket Lock #3727
Merged
frankyn added a commit that referenced this pull request Sep 28, 2018
@frankyn
[Storage] Bucket Lock (#3727)
bcb28f2
* [Storage] Replay GCS Bucket Lock (#3645)

* Add support for defaultEventBasedHold

* Add support for Blob eventBasedHold

* Add support for blob temporary holds

* Remove Beta launch annotations for CMEK

* Add support for lockRetentionPolicy and RetentionPolicy

* Update FakeStorageRPC

* codacy-bot review fix (final only)

* Update getRetentionPolicyIsLocked() -> retentionPolicyIsLocked() and misc.

* Address comments

* Address comments

* Address comments.

* Small nits

* Fix additional comments

* [Storage] Bucket lock samples and bug fixes. (#3709)

* Fix issue in tests, write bucket lock samples, and resolve issue in client library

* Update documentation around Boolean returns to clarify different return caes.

* Fix broken unit test

* Address feedback

* Fix typo in comments
suztomo pushed a commit that referenced this pull request Mar 9, 2026
@renovate-bot
chore(deps): update dependency com.google.cloud:google-cloud-bigtable…
252e3b9
… to v2.54.0 (#3709)
lqiu96 pushed a commit that referenced this pull request Mar 20, 2026
@renovate-bot
chore(deps): update dependency com.google.cloud:google-cloud-bigtable…
c5d9264
… to v2.54.0 (#3709)
chingor13 pushed a commit that referenced this pull request Mar 24, 2026
@JoeWang1127
chore: update logging mod (#3709)
8328e12
A follow up of #3706:
- Change the group id to `com.google.cloud` as it is a customer-facing
library.
- Add clirr and enforcer check in CI.
chingor13 pushed a commit that referenced this pull request Mar 24, 2026
@surbhigarg92 @cloud-java-bot
feat: [Internal] open telemetry built in metrics for GRPC (#3709)
71330af
* feat: grpc metrics

* test

* grpc metrics env check

* skip test and clirr

* add grpc metrics in allowed metrics

* test: logs

* chore: generate libraries at Wed Apr  2 17:15:18 UTC 2025

* chore: generate libraries at Wed Apr  2 17:18:00 UTC 2025

* remove logs

* review

* clirr

* review comments

* enable grpc metrics only env is set to false

---------

Co-authored-by: cloud-java-bot <[email protected]>
suztomo pushed a commit that referenced this pull request Mar 30, 2026
@frankyn
[Storage] Bucket Lock (#3727)
d2a8de9
* [Storage] Replay GCS Bucket Lock (#3645)

* Add support for defaultEventBasedHold

* Add support for Blob eventBasedHold

* Add support for blob temporary holds

* Remove Beta launch annotations for CMEK

* Add support for lockRetentionPolicy and RetentionPolicy

* Update FakeStorageRPC

* codacy-bot review fix (final only)

* Update getRetentionPolicyIsLocked() -> retentionPolicyIsLocked() and misc.

* Address comments

* Address comments

* Address comments.

* Small nits

* Fix additional comments

* [Storage] Bucket lock samples and bug fixes. (#3709)

* Fix issue in tests, write bucket lock samples, and resolve issue in client library

* Update documentation around Boolean returns to clarify different return caes.

* Fix broken unit test

* Address feedback

* Fix typo in comments
lqiu96 pushed a commit that referenced this pull request Apr 1, 2026
@frankyn
[Storage] Bucket Lock (#3727)
4ecdb29
* [Storage] Replay GCS Bucket Lock (#3645)

* Add support for defaultEventBasedHold

* Add support for Blob eventBasedHold

* Add support for blob temporary holds

* Remove Beta launch annotations for CMEK

* Add support for lockRetentionPolicy and RetentionPolicy

* Update FakeStorageRPC

* codacy-bot review fix (final only)

* Update getRetentionPolicyIsLocked() -> retentionPolicyIsLocked() and misc.

* Address comments

* Address comments

* Address comments.

* Small nits

* Fix additional comments

* [Storage] Bucket lock samples and bug fixes. (#3709)

* Fix issue in tests, write bucket lock samples, and resolve issue in client library

* Update documentation around Boolean returns to clarify different return caes.

* Fix broken unit test

* Address feedback

* Fix typo in comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@kurtisvg kurtisvg kurtisvg approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@frankyn @kurtisvg @googlebot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.