-
Notifications
You must be signed in to change notification settings - Fork 102
feat: Add GcRuleBuilder for safe GC rule construction #2758
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
base: main
Are you sure you want to change the base?
Conversation
...le-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/GcRuleBuilder.java
Outdated
Show resolved
Hide resolved
...le-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/GcRuleBuilder.java
Outdated
Show resolved
Hide resolved
...le-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/GcRuleBuilder.java
Outdated
Show resolved
Hide resolved
...loud-bigtable/src/test/java/com/google/cloud/bigtable/admin/v2/models/GcRuleBuilderTest.java
Show resolved
Hide resolved
| public static IntersectionRuleBuilder intersection() { | ||
| return new IntersectionRuleBuilder(); | ||
| } | ||
|
|
||
| /** | ||
| * Starts building a Union (OR) rule. | ||
| * | ||
| * @return A new builder for a union rule. | ||
| */ | ||
| public static UnionRuleBuilder union() { | ||
| return new UnionRuleBuilder(); | ||
| } |
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.
nit: Have we considered naming like:
- GcRuleUnionBuilder
- GcRuleIntersectionBuilder
I think it may be clearer for users that these are specifically for GcRules. I guess that in the context it will generally be:
GcRuleBuilder.union().addRule(...)
or
UnionRuleBuilder ruleBuilder = GcRuleBuilder.union();
ruleBuilder.add(...)
which is also pretty clear.
lqiu96
left a comment
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
This PR introduces
GcRuleBuilderand associated helpers to provide a type-safe way to construct Bigtable Garbage Collection rules.Changes:
GcRuleBuilderfactory to prevent silent overwrites ofoneoffields (e.g., accidentally setting bothmax_ageandmax_versions).IntersectionandUnionrules (IntersectionRuleBuilder,UnionRuleBuilder).GcRuleBuilderTestto verify correct proto construction.Context:
This addresses the "Garbage Collection Rules" Critical User Journey (CUJ) for the Admin API modernization.
Tracking Bug:
b/475818580