New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add RPO metadata settings #1105
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f3c40da
(feat) Add RPO metadata settings
JesseLovelace 6827362
Add javadoc
JesseLovelace 1edd216
Apply suggestions from code review
JesseLovelace 3861b37
typo
JesseLovelace fcb757d
Merge branch 'main' into turborep
JesseLovelace ce47c97
🦉 Updates from OwlBot
gcf-owl-bot[bot] 5ea4e8b
Merge branch 'turborep' of github.com:googleapis/java-storage into tu…
JesseLovelace 38d38e8
fix clirr
JesseLovelace File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
google-cloud-storage/src/main/java/com/google/cloud/storage/Rpo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright 2021 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.google.cloud.storage; | ||
|
||
import com.google.api.core.ApiFunction; | ||
import com.google.cloud.StringEnumType; | ||
import com.google.cloud.StringEnumValue; | ||
|
||
/** | ||
* Enums for the Recovery Point Objective (RPO) of dual-region buckets, which determines how fast | ||
* data is replicated betweens regions. | ||
* | ||
* @see <a | ||
* href="https://cloud.google.com/storage/docs/turbo-replication">https://cloud.google.com/storage/docs/turbo-replication</a> | ||
*/ | ||
public class Rpo extends StringEnumValue { | ||
JesseLovelace marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
private static final long serialVersionUID = -3954216195295821508L; | ||
|
||
private Rpo(String constant) { | ||
super(constant); | ||
} | ||
|
||
private static final ApiFunction<String, Rpo> CONSTRUCTOR = Rpo::new; | ||
|
||
private static final StringEnumType<Rpo> type = new StringEnumType(Rpo.class, CONSTRUCTOR); | ||
JesseLovelace marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
* Default recovery point objective. With this setting, there is no guarantee on the amount of | ||
* time it takes for data to replicate between regions. | ||
*/ | ||
public static final Rpo DEFAULT = type.createAndRegister("DEFAULT"); | ||
|
||
/** | ||
* Turbo recovery point objective. With this setting, data in a dual-region bucket will replicate | ||
* between regions within 15 minutes. | ||
*/ | ||
public static final Rpo ASYNC_TURBO = type.createAndRegister("ASYNC_TURBO"); | ||
|
||
/** | ||
* Get the Rpo for the given String constant, and throw an exception if the constant is not | ||
* recognized. | ||
*/ | ||
public static Rpo valueOfStrict(String constant) { | ||
return type.valueOfStrict(constant); | ||
} | ||
|
||
/** Get the Rpo for the given String constant, and allow unrecognized values. */ | ||
public static Rpo valueOf(String constant) { | ||
return type.valueOf(constant); | ||
} | ||
|
||
/** Return the known values for Rpo. */ | ||
public static Rpo[] values() { | ||
return type.values(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
@BenWhitehead we hit this each time we make a change to a public interface, we've been told it's to protect us from breaking changes, however we are committing breaking changes. It has gone on for years. What are your thoughts on this?
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.
Clirr is in place to primarily help us know if we are committing a change that breaks binary compatibility. The place it's most beneficial is on our generated code and our "main" apis. In this case, it's less beneficial and unfortunately BucketInfo.Builder is abstract and not annotated with
@InternalExtensionOnly
which would give us leeway to add methods with no guarantee of binary compatibility for out of project implementations. However, adding this annotation is itself considered a breaking change and would need to be performed at a major version.Our policy for model classes in general has been that we consider them to generally be safe for adding new methods, unfortunately clirr isn't capable of being made aware that this is a model class and instead requires an entry defined. Unfortunately, at this point, I think we're sort of stuck having to deal with this file until either we reach a new major version when we can annotate this builder and define a general rule or we decide to refactor things and make this class not be abstract and instead simply non-final.