eolivelli commented on code in PR #16412:
URL: https://github.com/apache/pulsar/pull/16412#discussion_r925292652


##########
pulsar-client-admin-api/src/main/java/org/apache/pulsar/client/admin/Namespaces.java:
##########
@@ -4467,4 +4467,18 @@ void setIsAllowAutoUpdateSchema(String namespace, 
boolean isAllowAutoUpdateSchem
      * @return
      */
     CompletableFuture<Void> removeNamespaceResourceGroupAsync(String 
namespace);
+
+    /**
+     * Scan offloaded ledgers on a namespace.
+     * @param namespace
+     * @return
+     */
+    String scanOffloadedLedgers(String namespace) throws PulsarAdminException;

Review Comment:
   as a short term solution this API works.
   
   Ideally I would do it as:
   `void scanOffloadedLedgers(String namespace, Consumer<String> lineReader) 
throws PulsarAdminException;
   `
   and pass to the Consumer each "line" of the response
   
   or better:
   ```
   void scanOffloadedLedgers(String namespace, ScanOffloadedLedgerCallback 
callback) throws PulsarAdminException;
   
   interface ScanOffloadedLedgerCallback {
          void begin(ScanControl control);
          void value(String key, Object value); // single value, like 
"total"....
          void ledger(OffloadedLedgerInfo info)  // called for each ledger
          void end(); // signal the end of the result
   }
   
   class OffloadedLedgerInfo {
       long ledgerId;
       .... 
   }
   interface ScanControl {
      void stopScan();  // close the HTTP connection/client abruptly
   }
   ```
   
   I didn't implement the third option because it requires to use some JSON 
Streaming Scanner (and I don't have experience)
   
   
   
   



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