Interface RegistrationManager

    • Method Detail

      • close

        void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • getClusterInstanceId

        java.lang.String getClusterInstanceId()
                                       throws BookieException
        Return the cluster instance id.
        Returns:
        the cluster instance id.
        Throws:
        BookieException
      • registerBookie

        void registerBookie​(BookieId bookieId,
                            boolean readOnly,
                            BookieServiceInfo serviceInfo)
                     throws BookieException
        Registering the bookie server as bookieId.
        Parameters:
        bookieId - bookie id
        readOnly - whether to register it as writable or readonly
        serviceInfo - information about services exposed by the Bookie
        Throws:
        BookieException - when fail to register a bookie.
      • unregisterBookie

        void unregisterBookie​(BookieId bookieId,
                              boolean readOnly)
                       throws BookieException
        Unregistering the bookie server as bookieId.
        Parameters:
        bookieId - bookie id
        readOnly - whether to register it as writable or readonly
        Throws:
        BookieException - when fail to unregister a bookie.
      • isBookieRegistered

        boolean isBookieRegistered​(BookieId bookieId)
                            throws BookieException
        Checks if Bookie with the given BookieId is registered as readwrite or readonly bookie.
        Parameters:
        bookieId - bookie id
        Returns:
        returns true if a bookie with bookieid is currently registered as readwrite or readonly bookie.
        Throws:
        BookieException
      • writeCookie

        void writeCookie​(BookieId bookieId,
                         Versioned<byte[]> cookieData)
                  throws BookieException
        Write the cookie data, which will be used for verifying the integrity of the bookie environment.
        Parameters:
        bookieId - bookie id
        cookieData - cookie data
        Throws:
        BookieException - when fail to write cookie
      • readCookie

        Versioned<byte[]> readCookie​(BookieId bookieId)
                              throws BookieException
        Read the cookie data, which will be used for verifying the integrity of the bookie environment.
        Parameters:
        bookieId - bookie id
        Returns:
        versioned cookie data
        Throws:
        BookieException - when fail to read cookie
      • removeCookie

        void removeCookie​(BookieId bookieId,
                          Version version)
                   throws BookieException
        Remove the cookie data.
        Parameters:
        bookieId - bookie id
        version - version of the cookie data
        Throws:
        BookieException - when fail to remove cookie
      • prepareFormat

        boolean prepareFormat()
                       throws java.lang.Exception
        Prepare ledgers root node, availableNode, readonly node..
        Returns:
        Returns true if old data exists, false if not.
        Throws:
        java.lang.Exception
      • initNewCluster

        boolean initNewCluster()
                        throws java.lang.Exception
        Initializes new cluster by creating required znodes for the cluster. If ledgersrootpath is already existing then it will error out.
        Returns:
        returns true if new cluster is successfully created or false if it failed to initialize.
        Throws:
        java.lang.Exception
      • format

        boolean format()
                throws java.lang.Exception
        Do format boolean.
        Returns:
        Returns true if success do format, false if not.
        Throws:
        java.lang.Exception
      • nukeExistingCluster

        boolean nukeExistingCluster()
                             throws java.lang.Exception
        Nukes existing cluster metadata.
        Returns:
        returns true if cluster metadata is successfully nuked or false if it failed to nuke the cluster metadata.
        Throws:
        java.lang.Exception
      • addRegistrationListener

        void addRegistrationListener​(RegistrationManager.RegistrationListener listener)
        Add a listener to be triggered when an registration event occurs.
        Parameters:
        listener - the listener to be added