Class CelReferenceContinuePredicate<O extends org.apache.polaris.persistence.nosql.api.obj.BaseCommitObj>
java.lang.Object
org.apache.polaris.maintenance.cel.CelReferenceContinuePredicate<O>
- All Implemented Interfaces:
Predicate<O>
public class CelReferenceContinuePredicate<O extends org.apache.polaris.persistence.nosql.api.obj.BaseCommitObj>
extends Object
implements Predicate<O>
Provides a CEL script based "retain reference commit object" predicate used for
RetainCollector.refRetain*() functions.
The predicate is coded as a CEL script, using cel-java.
Micro benchmarks prove that the CEL scripts execute pretty fast, definitely fast enough to justify the flexibility of having scripts in the configuration.
The scripts have access to the following declared values:
- "ref" (string) name of the reference
- "commits" (64-bit int) number of the currently processed commit, starting at
1 - "ageDays" (64-bit int) age of currently processed commit in days
- "ageHours" (64-bit int) age of currently processed commit in hours
- "ageMinutes" (64-bit int) age of currently processed commit in minutes
Scripts must return a boolean yielding whether the commit shall be retained.
Note that maintenance-service implementations can keep the first not-to-be-retained commit.
Example scripts
ageDays < 30 || commits <= 10retains the reference history with at least 10 commits and commits that are younger than 30 daystrueretains the whole reference historyfalseretains the most recent commit
A static cache retains up to 100 compiled CEL scripts, each up to 24 hours after its last use.
-
Constructor Summary
ConstructorsConstructorDescriptionCelReferenceContinuePredicate(String refName, org.apache.polaris.persistence.nosql.api.Persistence persistence, String script) -
Method Summary