Class PulsarLedgerIdGenerator

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, org.apache.bookkeeper.meta.LedgerIdGenerator

    public class PulsarLedgerIdGenerator
    extends java.lang.Object
    implements org.apache.bookkeeper.meta.LedgerIdGenerator
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void generateLedgerId​(org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.GenericCallback<java.lang.Long> genericCallback)  
      java.util.concurrent.CompletableFuture<java.lang.Long> generateLedgerIdImpl​(java.lang.String prefix)  
      java.util.concurrent.CompletableFuture<java.lang.Boolean> ledgerIdGenPathPresent()
      Checks the existence of the long ledger id gen path.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PulsarLedgerIdGenerator

        public PulsarLedgerIdGenerator​(MetadataStoreExtended store,
                                       java.lang.String ledgersRoot)
    • Method Detail

      • generateLedgerId

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

        public java.util.concurrent.CompletableFuture<java.lang.Long> generateLedgerIdImpl​(java.lang.String prefix)
      • close

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

        public java.util.concurrent.CompletableFuture<java.lang.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.