dimas-b commented on code in PR #3268:
URL: https://github.com/apache/polaris/pull/3268#discussion_r2623846411


##########
persistence/nosql/persistence/metastore-maintenance/src/main/java/org/apache/polaris/persistence/nosql/metastore/maintenance/CatalogsMaintenanceConfig.java:
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.persistence.nosql.metastore.maintenance;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import io.smallrye.config.ConfigMapping;
+import io.smallrye.config.WithDefault;
+import java.util.Optional;
+import org.apache.polaris.immutables.PolarisImmutable;
+
+/**
+ * Polaris stores a history of changes per kind of object (principals, 
principal roles, grants,
+ * immediate tasks, catalog roles and catalog state).
+ *
+ * <p>The rules are defined using a <a 
href="https://github.com/projectnessie/cel-java/";>CEL
+ * script</a>. The default rules for all kinds of objects are to retain the 
history for 3 days, for
+ * the catalog state for 30 days.
+ *
+ * <p>The scripts have access to the following declared values:
+ *
+ * <ul>
+ *   <li>{@code ref} (string) name of the reference
+ *   <li>{@code commits} (64-bit int) number of the currently processed 
commit, starting at {@code
+ *       1}
+ *   <li>{@code ageDays} (64-bit int) age of currently processed commit in days
+ *   <li>{@code ageHours} (64-bit int) age of currently processed commit in 
hours
+ *   <li>{@code ageMinutes} (64-bit int) age of currently processed commit in 
minutes
+ * </ul>
+ *
+ * <p>Scripts <em>must</em> return a {@code boolean} yielding whether the 
commit shall be retained.
+ * Note that maintenance-service implementations can keep the first 
not-to-be-retained commit.
+ *
+ * <p>Example scripts
+ *
+ * <ul>
+ *   <li>{@code ageDays < 30 || commits <= 10} retains the reference history 
with at least 10
+ *       commits and commits that are younger than 30 days
+ *   <li>{@code true} retains the whole reference history
+ *   <li>{@code false} retains the most recent commit
+ * </ul>
+ */
+@ConfigMapping(prefix = "polaris.persistence.maintenance.catalog")

Review Comment:
   Given the discussion in #3135, I think it is reasonable to use the 
`polaris.persistence.nosql` config prefix in this PR.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to