Class PulsarLedgerIdGenerator

java.lang.Object
org.apache.pulsar.metadata.bookkeeper.PulsarLedgerIdGenerator
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.bookkeeper.meta.LedgerIdGenerator

public class PulsarLedgerIdGenerator extends Object implements org.apache.bookkeeper.meta.LedgerIdGenerator
  • Constructor Details

  • Method Details

    • generateLedgerId

      public void generateLedgerId(org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.GenericCallback<Long> genericCallback)
      Specified by:
      generateLedgerId in interface org.apache.bookkeeper.meta.LedgerIdGenerator
    • generateLedgerIdImpl

      public CompletableFuture<Long> generateLedgerIdImpl(String prefix)
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException
    • ledgerIdGenPathPresent

      public CompletableFuture<Boolean> ledgerIdGenPathPresent()
      Checks the existence of the long ledger id gen path. Existence indicates we have switched from the legacy algorithm to the new method of generating 63-bit ids. If the existence is UNKNOWN, it looks in zk to find out. If it previously checked in zk, it returns that value. This value changes when we run out of ids < Integer.MAX_VALUE, and try to create the long ledger id gen path.