You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/08/15 07:09:13 UTC

[GitHub] [pulsar] zhanghaou commented on a change in pull request #7817: [ISSUE 7757] Support Persistence Policies on topic level

zhanghaou commented on a change in pull request #7817:
URL: https://github.com/apache/pulsar/pull/7817#discussion_r470947991



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -2294,6 +2295,48 @@ protected void internalGetRetention(AsyncResponse asyncResponse){
         return pulsar().getTopicPoliciesService().updateTopicPoliciesAsync(topicName, topicPolicies.get());
     }
 
+    protected void internalGetPersistence(AsyncResponse asyncResponse){
+        validateAdminAccessForTenant(namespaceName.getTenant());
+        validatePoliciesReadOnlyAccess();
+        if (topicName.isGlobal()) {
+            validateGlobalNamespaceOwnership(namespaceName);
+        }
+        Optional<PersistencePolicies> retention = getTopicPolicies(topicName)
+                .map(TopicPolicies::getPersistence);
+        if (!retention.isPresent()) {
+            asyncResponse.resume(Response.noContent().build());
+        }else {
+            asyncResponse.resume(retention.get());
+        }
+    }

Review comment:
       It is same to internalGetRetention(), maybe we can modify it all at once.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org