Package org.apache.bookkeeper.meta
Interface LedgerManagerFactory
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
AbstractZkLedgerManagerFactory,FlatLedgerManagerFactory,HierarchicalLedgerManagerFactory,LegacyHierarchicalLedgerManagerFactory,LongHierarchicalLedgerManagerFactory,MSLedgerManagerFactory,NullMetadataBookieDriver.NullLedgerManagerFactory
A factory for creating ledger managers.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Uninitialize the factory.voidformat(AbstractConfiguration<?> conf, LayoutManager lm) Format the ledger metadata for LedgerManager.intReturn current factory version.initialize(AbstractConfiguration conf, LayoutManager layoutManager, int factoryVersion) Initialize a factory.Return a ledger auditor manager, which is used to coordinate the auto-recovery process.Return the ledger id generator, which is used for global unique ledger id generation.return ledger manager for client-side to manage ledger metadata.Return a ledger underreplication manager, which is used to mark ledgers as unreplicated, and to retrieve a ledger which is underreplicated so that it can be rereplicated.booleanThis method makes sure there are no unexpected znodes under ledgersRootPath and then it proceeds with ledger metadata formatting and nuking the cluster ZK state info.
-
Method Details
-
getCurrentVersion
int getCurrentVersion()Return current factory version.- Returns:
- current version used by factory.
-
initialize
LedgerManagerFactory initialize(AbstractConfiguration conf, LayoutManager layoutManager, int factoryVersion) throws IOException Initialize a factory.- Parameters:
conf- Configuration object used to initialize factorylayoutManager- Layout manager used for initialize ledger manager factoryfactoryVersion- What version used to initialize factory.- Returns:
- ledger manager factory instance
- Throws:
IOException- when fail to initialize the factory.
-
close
Uninitialize the factory.- Specified by:
closein interfaceAutoCloseable- Throws:
IOException- when fail to uninitialize the factory.
-
newLedgerIdGenerator
LedgerIdGenerator newLedgerIdGenerator()Return the ledger id generator, which is used for global unique ledger id generation.- Returns:
- ledger id generator.
-
newLedgerManager
LedgerManager newLedgerManager()return ledger manager for client-side to manage ledger metadata.- Returns:
- ledger manager
- See Also:
-
newLedgerUnderreplicationManager
LedgerUnderreplicationManager newLedgerUnderreplicationManager() throws ReplicationException.UnavailableException, InterruptedException, ReplicationException.CompatibilityExceptionReturn a ledger underreplication manager, which is used to mark ledgers as unreplicated, and to retrieve a ledger which is underreplicated so that it can be rereplicated.- Returns:
- ledger underreplication manager
- Throws:
ReplicationException.UnavailableExceptionInterruptedExceptionReplicationException.CompatibilityException- See Also:
-
newLedgerAuditorManager
Return a ledger auditor manager, which is used to coordinate the auto-recovery process.- Returns:
- ledger auditor manager
- Throws:
IOExceptionInterruptedException- See Also:
-
format
void format(AbstractConfiguration<?> conf, LayoutManager lm) throws InterruptedException, org.apache.zookeeper.KeeperException, IOException Format the ledger metadata for LedgerManager.- Parameters:
conf- Configuration instancelm- Layout manager- Throws:
InterruptedExceptionorg.apache.zookeeper.KeeperExceptionIOException
-
validateAndNukeExistingCluster
boolean validateAndNukeExistingCluster(AbstractConfiguration<?> conf, LayoutManager lm) throws InterruptedException, org.apache.zookeeper.KeeperException, IOException This method makes sure there are no unexpected znodes under ledgersRootPath and then it proceeds with ledger metadata formatting and nuking the cluster ZK state info.- Parameters:
conf- Configuration instancelm- Layout manager- Throws:
IOExceptionorg.apache.zookeeper.KeeperExceptionInterruptedException
-