Class ZkLayoutManager

  • All Implemented Interfaces:
    LayoutManager

    public class ZkLayoutManager
    extends java.lang.Object
    implements LayoutManager
    Provide utils for writing/reading/deleting layout in zookeeper.
    • Constructor Detail

      • ZkLayoutManager

        public ZkLayoutManager​(org.apache.zookeeper.ZooKeeper zk,
                               java.lang.String ledgersRoot,
                               java.util.List<org.apache.zookeeper.data.ACL> acls)
    • 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 interface LayoutManager
        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 interface LayoutManager
        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 interface LayoutManager
        Throws:
        java.io.IOException