Package org.apache.bookkeeper.meta
Class ZkLayoutManager
- java.lang.Object
-
- org.apache.bookkeeper.meta.ZkLayoutManager
-
- All Implemented Interfaces:
LayoutManager
public class ZkLayoutManager extends java.lang.Object implements LayoutManager
Provide utils for writing/reading/deleting layout in zookeeper.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.bookkeeper.meta.LayoutManager
LayoutManager.LedgerLayoutExistsException
-
-
Constructor Summary
Constructors Constructor Description ZkLayoutManager(org.apache.zookeeper.ZooKeeper zk, java.lang.String ledgersRoot, java.util.List<org.apache.zookeeper.data.ACL> acls)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteLedgerLayout()
Delete the ledger layout from zookeeper.org.apache.zookeeper.ZooKeeper
getZk()
LedgerLayout
readLedgerLayout()
Read ledger layout from zookeeper.void
storeLedgerLayout(LedgerLayout layout)
Store the ledger layout to zookeeper.
-
-
-
Method Detail
-
getZk
public org.apache.zookeeper.ZooKeeper getZk()
-
readLedgerLayout
public LedgerLayout readLedgerLayout() throws java.io.IOException
Read ledger layout from zookeeper.- Specified by:
readLedgerLayout
in interfaceLayoutManager
- Returns:
- ledger layout, or null if none set in zookeeper
- Throws:
java.io.IOException
- when fail to read ledger layout.
-
storeLedgerLayout
public void storeLedgerLayout(LedgerLayout layout) throws java.io.IOException
Store the ledger layout to zookeeper.- Specified by:
storeLedgerLayout
in interfaceLayoutManager
- Parameters:
layout
- ledger layout- Throws:
java.io.IOException
- when fail to store ledger layout.
-
deleteLedgerLayout
public void deleteLedgerLayout() throws java.io.IOException
Delete the ledger layout from zookeeper.- Specified by:
deleteLedgerLayout
in interfaceLayoutManager
- Throws:
java.io.IOException
-
-