Package org.apache.bookkeeper.meta
Interface LedgerManagerFactory
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Implementing Classes:
AbstractZkLedgerManagerFactory
,FlatLedgerManagerFactory
,HierarchicalLedgerManagerFactory
,LegacyHierarchicalLedgerManagerFactory
,LongHierarchicalLedgerManagerFactory
,MSLedgerManagerFactory
,NullMetadataBookieDriver.NullLedgerManagerFactory
public interface LedgerManagerFactory extends java.lang.AutoCloseable
A factory for creating ledger managers.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Uninitialize the factory.void
format(AbstractConfiguration<?> conf, LayoutManager lm)
Format the ledger metadata for LedgerManager.int
getCurrentVersion()
Return current factory version.LedgerManagerFactory
initialize(AbstractConfiguration conf, LayoutManager layoutManager, int factoryVersion)
Initialize a factory.LedgerAuditorManager
newLedgerAuditorManager()
Return a ledger auditor manager, which is used to coordinate the auto-recovery process.LedgerIdGenerator
newLedgerIdGenerator()
Return the ledger id generator, which is used for global unique ledger id generation.LedgerManager
newLedgerManager()
return ledger manager for client-side to manage ledger metadata.LedgerUnderreplicationManager
newLedgerUnderreplicationManager()
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.boolean
validateAndNukeExistingCluster(AbstractConfiguration<?> conf, LayoutManager lm)
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.
-
-
-
Method Detail
-
getCurrentVersion
int getCurrentVersion()
Return current factory version.- Returns:
- current version used by factory.
-
initialize
LedgerManagerFactory initialize(AbstractConfiguration conf, LayoutManager layoutManager, int factoryVersion) throws java.io.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:
java.io.IOException
- when fail to initialize the factory.
-
close
void close() throws java.io.IOException
Uninitialize the factory.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
java.io.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:
LedgerManager
-
newLedgerUnderreplicationManager
LedgerUnderreplicationManager newLedgerUnderreplicationManager() throws ReplicationException.UnavailableException, java.lang.InterruptedException, ReplicationException.CompatibilityException
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.- Returns:
- ledger underreplication manager
- Throws:
ReplicationException.UnavailableException
java.lang.InterruptedException
ReplicationException.CompatibilityException
- See Also:
LedgerUnderreplicationManager
-
newLedgerAuditorManager
LedgerAuditorManager newLedgerAuditorManager() throws java.io.IOException, java.lang.InterruptedException
Return a ledger auditor manager, which is used to coordinate the auto-recovery process.- Returns:
- ledger auditor manager
- Throws:
java.io.IOException
java.lang.InterruptedException
- See Also:
LedgerAuditorManager
-
format
void format(AbstractConfiguration<?> conf, LayoutManager lm) throws java.lang.InterruptedException, org.apache.zookeeper.KeeperException, java.io.IOException
Format the ledger metadata for LedgerManager.- Parameters:
conf
- Configuration instancelm
- Layout manager- Throws:
java.lang.InterruptedException
org.apache.zookeeper.KeeperException
java.io.IOException
-
validateAndNukeExistingCluster
boolean validateAndNukeExistingCluster(AbstractConfiguration<?> conf, LayoutManager lm) throws java.lang.InterruptedException, org.apache.zookeeper.KeeperException, java.io.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:
java.io.IOException
org.apache.zookeeper.KeeperException
java.lang.InterruptedException
-
-