henry3260 commented on code in PR #11157:
URL: https://github.com/apache/ozone/pull/11157#discussion_r3886071347


##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneLifecycleConfiguration.java:
##########
@@ -172,6 +203,23 @@ public OzoneLCAbortIncompleteMultipartUpload 
getAbortIncompleteMultipartUpload()
     public OzoneLCFilter getFilter() {
       return filter;
     }
+
+    public boolean isEnabled() {
+      return "Enabled".equals(status);
+    }
+
+    /**
+     * Matches this rule's prefix or filter against a key. Unlike the
+     * server-side OmLCRule#match, which the lifecycle service uses to pick 
keys
+     * that are already due for deletion, this only answers whether the rule
+     * covers the key, so callers can report a future expiry date for it.
+     */
+    public boolean matches(String keyPath, Map<String, String> keyTags) {

Review Comment:
   > `OzoneLCRule.matches` checks `prefix != null` before `filter`, but S3's 
lifecycle spec treats the top-level `Prefix` element as deprecated in favour of 
`Filter`. A rule can theoretically carry both (during a schema migration). The 
comment acknowledges this is a simplified "does the rule cover the key" check, 
so the current priority order is acceptable, but it would be worth a brief 
inline note explaining why `prefix` wins over `filter` when both are set, so 
future maintainers don't inadvertently flip the order.
   
   Added the note, thanks. I worded it as mutual exclusion rather than 
precedence,
   because OmLCRule#valid rejects a rule that sets both prefix and filter, and 
one
   that sets neither -- so exactly one is always present and the order can't 
actually matter:
   
   
https://github.com/apache/ozone/blob/a17ad8798a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmLCRule.java#L209-L218
   



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to