Hi,
I am looking for an API to read ledger metadata without actually opening a
ledger.

Currently opening a ledger sets a watch on ZK and this is really expensive
and in any case the desired action is not to "open a ledger" but to access
meta information about the ledger.

My real usecase is that I want to list ledgers and filter the results using
custom metadata.

If there is no available solution I would like to file and issue and a
proposal to have a new method in the new API like

org.apache.bookkeeper.client.api.LedgerMetadata {
    public long getId();
    public Map<String, byte[]> getCustomMetadata();
    public long getCtime();
}

org.apache.bookkeeper.client.api.BookKeeper {

      LedgerMetadata getLedgerMetadata(long ledgerId);
      void listLedgers(String query, Consumer<LedgerMetadata> consumer)

}

for the "query" we can define a simple "expression language"

metadata.owner = 'xxx' and (metadata.type = 'yyyy' or metadata.type =
'zzzz')

we can provide a basic implementation of that language which actually works
on LedgerMetadata objects and internally we will loop over the ledgers and
apply the expression to every ledger
the basic implementation can leverage standard expression languages like EL

smarter implementations of LedgerManager will be able to narrow the search
and save resources

Thoughts ?

-- Enrico

Reply via email to