Package org.apache.bookkeeper.meta
Class NullMetadataBookieDriver.NullRegistrationManager
java.lang.Object
org.apache.bookkeeper.meta.NullMetadataBookieDriver.NullRegistrationManager
- All Implemented Interfaces:
AutoCloseable,RegistrationManager
- Enclosing class:
- NullMetadataBookieDriver
public static class NullMetadataBookieDriver.NullRegistrationManager
extends Object
implements RegistrationManager
A no-op implementation of RegistrationManager.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.bookkeeper.discover.RegistrationManager
RegistrationManager.RegistrationListener -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a listener to be triggered when an registration event occurs.voidclose()booleanformat()Do format boolean.Return the cluster instance id.booleanInitializes new cluster by creating required znodes for the cluster.booleanisBookieRegistered(BookieId bookieId) Checks if Bookie with the given BookieId is registered as readwrite or readonly bookie.booleanNukes existing cluster metadata.booleanPrepare ledgers root node, availableNode, readonly node..Versioned<byte[]>readCookie(BookieId bookieId) Read the cookie data, which will be used for verifying the integrity of the bookie environment.voidregisterBookie(BookieId bookieId, boolean readOnly, BookieServiceInfo bookieService) Registering the bookie server as bookieId.voidremoveCookie(BookieId bookieId, Version version) Remove the cookie data.voidunregisterBookie(BookieId bookieId, boolean readOnly) Unregistering the bookie server as bookieId.voidwriteCookie(BookieId bookieId, Versioned<byte[]> cookieData) Write the cookie data, which will be used for verifying the integrity of the bookie environment.
-
Constructor Details
-
NullRegistrationManager
public NullRegistrationManager()
-
-
Method Details
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceRegistrationManager
-
getClusterInstanceId
Description copied from interface:RegistrationManagerReturn the cluster instance id.- Specified by:
getClusterInstanceIdin interfaceRegistrationManager- Returns:
- the cluster instance id.
-
registerBookie
Description copied from interface:RegistrationManagerRegistering the bookie server as bookieId.- Specified by:
registerBookiein interfaceRegistrationManager- Parameters:
bookieId- bookie idreadOnly- whether to register it as writable or readonlybookieService- information about services exposed by the Bookie
-
unregisterBookie
Description copied from interface:RegistrationManagerUnregistering the bookie server as bookieId.- Specified by:
unregisterBookiein interfaceRegistrationManager- Parameters:
bookieId- bookie idreadOnly- whether to register it as writable or readonly
-
isBookieRegistered
Description copied from interface:RegistrationManagerChecks if Bookie with the given BookieId is registered as readwrite or readonly bookie.- Specified by:
isBookieRegisteredin interfaceRegistrationManager- Parameters:
bookieId- bookie id- Returns:
- returns true if a bookie with bookieid is currently registered as readwrite or readonly bookie.
-
writeCookie
Description copied from interface:RegistrationManagerWrite the cookie data, which will be used for verifying the integrity of the bookie environment.- Specified by:
writeCookiein interfaceRegistrationManager- Parameters:
bookieId- bookie idcookieData- cookie data- Throws:
BookieException- when fail to write cookie
-
readCookie
Description copied from interface:RegistrationManagerRead the cookie data, which will be used for verifying the integrity of the bookie environment.- Specified by:
readCookiein interfaceRegistrationManager- Parameters:
bookieId- bookie id- Returns:
- versioned cookie data
- Throws:
BookieException- when fail to read cookie
-
removeCookie
Description copied from interface:RegistrationManagerRemove the cookie data.- Specified by:
removeCookiein interfaceRegistrationManager- Parameters:
bookieId- bookie idversion- version of the cookie data
-
prepareFormat
public boolean prepareFormat()Description copied from interface:RegistrationManagerPrepare ledgers root node, availableNode, readonly node..- Specified by:
prepareFormatin interfaceRegistrationManager- Returns:
- Returns true if old data exists, false if not.
-
initNewCluster
public boolean initNewCluster()Description copied from interface:RegistrationManagerInitializes new cluster by creating required znodes for the cluster. If ledgersrootpath is already existing then it will error out.- Specified by:
initNewClusterin interfaceRegistrationManager- Returns:
- returns true if new cluster is successfully created or false if it failed to initialize.
-
format
public boolean format()Description copied from interface:RegistrationManagerDo format boolean.- Specified by:
formatin interfaceRegistrationManager- Returns:
- Returns true if success do format, false if not.
-
nukeExistingCluster
public boolean nukeExistingCluster()Description copied from interface:RegistrationManagerNukes existing cluster metadata.- Specified by:
nukeExistingClusterin interfaceRegistrationManager- Returns:
- returns true if cluster metadata is successfully nuked or false if it failed to nuke the cluster metadata.
-
addRegistrationListener
Description copied from interface:RegistrationManagerAdd a listener to be triggered when an registration event occurs.- Specified by:
addRegistrationListenerin interfaceRegistrationManager- Parameters:
listener- the listener to be added
-