Class PulsarLedgerIdGenerator
- java.lang.Object
-
- org.apache.pulsar.metadata.bookkeeper.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
-
-
Constructor Summary
Constructors Constructor Description PulsarLedgerIdGenerator(MetadataStoreExtended store, java.lang.String ledgersRoot)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidgenerateLedgerId(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.
-
-
-
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:
generateLedgerIdin interfaceorg.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:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.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.
-
-