-
Notifications
You must be signed in to change notification settings - Fork 130
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
Add Privilege for Updating Maintenance Properties in Catalog #457
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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 org.apache.polaris.core.entity; | ||
|
||
import static org.apache.polaris.core.entity.PolarisEntityConstants.MAINTENANCE_PREFIX; | ||
|
||
public enum PolarisMaintenanceProperties { | ||
COMPACTION(MAINTENANCE_PREFIX + "compaction"), | ||
SNAPSHOT_RETENTION(MAINTENANCE_PREFIX + "snapshot_expiration"); | ||
Comment on lines
+24
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will add more types, and validation in follow-up PRs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you are referring to the "expire snapshots"? Shouldn't the enum be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, the enum name says |
||
|
||
private final String value; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the name |
||
|
||
PolarisMaintenanceProperties(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
public static PolarisMaintenanceProperties fromValue(String value) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the added value of this method, as opposed to |
||
for (PolarisMaintenanceProperties property : PolarisMaintenanceProperties.values()) { | ||
if (property.value.equals(value)) { | ||
return property; | ||
} | ||
} | ||
throw new IllegalArgumentException("Unknown value: " + value); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,6 +102,9 @@ public enum PolarisPrivilege { | |
CATALOG_ROLE_FULL_METADATA(67, PolarisEntityType.CATALOG_ROLE), | ||
CATALOG_ROLE_MANAGE_GRANTS_ON_SECURABLE(68, PolarisEntityType.CATALOG_ROLE), | ||
CATALOG_ROLE_MANAGE_GRANTS_FOR_GRANTEE(69, PolarisEntityType.CATALOG_ROLE), | ||
TABLE_WRITE_MAINTENANCE_PROPERTIES(70, PolarisEntityType.TABLE_LIKE, PolarisEntitySubType.TABLE), | ||
NAMESPACE_WRITE_MAINTENANCE_PROPERTIES(71, PolarisEntityType.NAMESPACE), | ||
Comment on lines
+105
to
+106
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR focus on the catalog privilege only. The detailed implementation for table and namespace will be in follow-up PRs. |
||
CATALOG_WRITE_MAINTENANCE_PROPERTIES(72, PolarisEntityType.CATALOG), | ||
; | ||
flyrain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/** | ||
|
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.
tangential: This change LGTM, but I'm thinking about breaking down the operation enum into several enums with dedicated scope (operations within a catalog, catalog management (add/remote), permission management)... Just FYI :)