tpalfy commented on a change in pull request #5413:
URL: https://github.com/apache/nifi/pull/5413#discussion_r736548872



##########
File path: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/ListS3.java
##########
@@ -486,6 +546,147 @@ public void onTrigger(final ProcessContext context, final 
ProcessSession session
         }
     }
 
+    private void listByTrackingEntities(ProcessContext context, ProcessSession 
session) {
+        listedEntityTracker.trackEntities(context, session, 
justElectedPrimaryNode, Scope.CLUSTER, minTimestampToList -> {
+            String bucket = 
context.getProperty(BUCKET).evaluateAttributeExpressions().getValue();
+            S3BucketLister bucketLister = getS3BucketLister(context, 
getClient(), bucket);
+
+            List<ListableEntityWrapper<S3VersionSummary>> listedEntities = 
bucketLister.listVersions().getVersionSummaries()
+                .stream()
+                .filter(s3VersionSummary -> 
s3VersionSummary.getLastModified().getTime() >= minTimestampToList)
+                .map(s3VersionSummary -> new 
ListableEntityWrapper<S3VersionSummary>(
+                    s3VersionSummary,
+                    S3VersionSummary::getKey,
+                    summary -> summary.getKey() + "_" + summary.getVersionId(),
+                    summary -> summary.getLastModified().getTime(),
+                    S3VersionSummary::getSize
+                ))
+                .collect(Collectors.toList());
+
+            return listedEntities;

Review comment:
       I disagree with returning with an expression.
   I find it better return with a single variable.




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