Package org.apache.bookkeeper.meta
Class AbstractZkLedgerManagerFactory
java.lang.Object
org.apache.bookkeeper.meta.AbstractZkLedgerManagerFactory
- All Implemented Interfaces:
AutoCloseable,LedgerManagerFactory
- Direct Known Subclasses:
FlatLedgerManagerFactory,LegacyHierarchicalLedgerManagerFactory,MSLedgerManagerFactory
Abstract ledger manager factory based on zookeeper, which provides common
methods such as format and validateAndNukeExistingCluster.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static LedgerManagerFactorycreateNewLMFactory(AbstractConfiguration conf, LayoutManager layoutManager, Class<? extends LedgerManagerFactory> factoryClass) Creates the new layout and stores in zookeeper and returns the LedgerManagerFactory instance.voidformat(AbstractConfiguration<?> conf, LayoutManager layoutManager) Format the ledger metadata for LedgerManager.static LedgerManagerFactorynewLedgerManagerFactory(AbstractConfiguration<?> conf, LayoutManager layoutManager) Create new Ledger Manager Factory.booleanvalidateAndNukeExistingCluster(AbstractConfiguration<?> conf, LayoutManager layoutManager) 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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.bookkeeper.meta.LedgerManagerFactory
close, getCurrentVersion, initialize, newLedgerAuditorManager, newLedgerIdGenerator, newLedgerManager, newLedgerUnderreplicationManager
-
Field Details
-
zk
protected org.apache.zookeeper.ZooKeeper zk -
V1
static final int V1- See Also:
-
-
Constructor Details
-
AbstractZkLedgerManagerFactory
public AbstractZkLedgerManagerFactory()
-
-
Method Details
-
format
public void format(AbstractConfiguration<?> conf, LayoutManager layoutManager) throws InterruptedException, org.apache.zookeeper.KeeperException, IOException Description copied from interface:LedgerManagerFactoryFormat the ledger metadata for LedgerManager.- Specified by:
formatin interfaceLedgerManagerFactory- Parameters:
conf- Configuration instancelayoutManager- Layout manager- Throws:
InterruptedExceptionorg.apache.zookeeper.KeeperExceptionIOException
-
validateAndNukeExistingCluster
public boolean validateAndNukeExistingCluster(AbstractConfiguration<?> conf, LayoutManager layoutManager) throws InterruptedException, org.apache.zookeeper.KeeperException, IOException Description copied from interface:LedgerManagerFactoryThis 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.- Specified by:
validateAndNukeExistingClusterin interfaceLedgerManagerFactory- Parameters:
conf- Configuration instancelayoutManager- Layout manager- Throws:
InterruptedExceptionorg.apache.zookeeper.KeeperExceptionIOException
-
newLedgerManagerFactory
public static LedgerManagerFactory newLedgerManagerFactory(AbstractConfiguration<?> conf, LayoutManager layoutManager) throws IOException, InterruptedException Create new Ledger Manager Factory.- Parameters:
conf- Configuration Object.layoutManager- layout manager- Returns:
- new ledger manager factory
- Throws:
IOExceptionInterruptedException
-
createNewLMFactory
protected static LedgerManagerFactory createNewLMFactory(AbstractConfiguration conf, LayoutManager layoutManager, Class<? extends LedgerManagerFactory> factoryClass) throws IOException, InterruptedException Creates the new layout and stores in zookeeper and returns the LedgerManagerFactory instance.- Throws:
IOExceptionInterruptedException
-