Package org.apache.bookkeeper.meta
Class MetadataDrivers
- java.lang.Object
-
- org.apache.bookkeeper.meta.MetadataDrivers
-
public final class MetadataDrivers extends java.lang.ObjectA driver manager for managing a set of metadata drivers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classMetadataDrivers.MetadataBookieDriverInfo(package private) static classMetadataDrivers.MetadataClientDriverInfo
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.StringBK_METADATA_BOOKIE_DRIVERS_PROPERTY(package private) static java.lang.StringBK_METADATA_CLIENT_DRIVERS_PROPERTY(package private) static java.lang.StringZK_BOOKIE_DRIVER_CLASS(package private) static java.lang.StringZK_CLIENT_DRIVER_CLASS
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MetadataBookieDrivergetBookieDriver(java.lang.String scheme)Retrieve the bookie driver forscheme.static MetadataBookieDrivergetBookieDriver(java.net.URI uri)Retrieve the bookie driver foruri.(package private) static java.util.concurrent.ConcurrentMap<java.lang.String,MetadataDrivers.MetadataBookieDriverInfo>getBookieDrivers()static MetadataClientDrivergetClientDriver(java.lang.String scheme)Retrieve the client driver forscheme.static MetadataClientDrivergetClientDriver(java.net.URI uri)Retrieve the client driver foruri.(package private) static java.util.concurrent.ConcurrentMap<java.lang.String,MetadataDrivers.MetadataClientDriverInfo>getClientDrivers()(package private) static voidloadInitialDrivers()static voidregisterBookieDriver(java.lang.String metadataBackendScheme, java.lang.Class<? extends MetadataBookieDriver> driver)Register the metadata bookiedriver.static voidregisterBookieDriver(java.lang.String metadataBackendScheme, java.lang.Class<? extends MetadataBookieDriver> driver, boolean allowOverride)static voidregisterClientDriver(java.lang.String metadataBackendScheme, java.lang.Class<? extends MetadataClientDriver> driver)Register the metadata clientdriver.static voidregisterClientDriver(java.lang.String metadataBackendScheme, java.lang.Class<? extends MetadataClientDriver> driver, boolean allowOverride)static <T> TrunFunctionWithLedgerManagerFactory(ServerConfiguration conf, java.util.function.Function<LedgerManagerFactory,T> function)Process the provided function with ledger manager factory resolved from the metadata service uri returned byAbstractConfiguration.getMetadataServiceUri().static <T> TrunFunctionWithMetadataBookieDriver(ServerConfiguration conf, java.util.function.Function<MetadataBookieDriver,T> function)Process the provided function with metadata bookie driver resolved from the metadata service uri returned byAbstractConfiguration.getMetadataServiceUri().static <T> TrunFunctionWithMetadataClientDriver(ClientConfiguration conf, java.util.function.Function<MetadataClientDriver,T> function, java.util.concurrent.ScheduledExecutorService executorService)Process the provided function with metadata client driver resolved from the metadata service uri returned byAbstractConfiguration.getMetadataServiceUri().static <T> TrunFunctionWithRegistrationManager(ServerConfiguration conf, java.util.function.Function<RegistrationManager,T> function)Process the provided function with registration manager resolved from the metadata service uri returned byAbstractConfiguration.getMetadataServiceUri().
-
-
-
Field Detail
-
ZK_CLIENT_DRIVER_CLASS
static final java.lang.String ZK_CLIENT_DRIVER_CLASS
- See Also:
- Constant Field Values
-
ZK_BOOKIE_DRIVER_CLASS
static final java.lang.String ZK_BOOKIE_DRIVER_CLASS
- See Also:
- Constant Field Values
-
BK_METADATA_CLIENT_DRIVERS_PROPERTY
static final java.lang.String BK_METADATA_CLIENT_DRIVERS_PROPERTY
- See Also:
- Constant Field Values
-
BK_METADATA_BOOKIE_DRIVERS_PROPERTY
static final java.lang.String BK_METADATA_BOOKIE_DRIVERS_PROPERTY
- See Also:
- Constant Field Values
-
-
Method Detail
-
loadInitialDrivers
static void loadInitialDrivers()
-
registerClientDriver
public static void registerClientDriver(java.lang.String metadataBackendScheme, java.lang.Class<? extends MetadataClientDriver> driver)Register the metadata clientdriver.- Parameters:
metadataBackendScheme- scheme of metadata backend.driver- metadata client driver
-
registerClientDriver
public static void registerClientDriver(java.lang.String metadataBackendScheme, java.lang.Class<? extends MetadataClientDriver> driver, boolean allowOverride)
-
registerBookieDriver
public static void registerBookieDriver(java.lang.String metadataBackendScheme, java.lang.Class<? extends MetadataBookieDriver> driver)Register the metadata bookiedriver.- Parameters:
metadataBackendScheme- scheme of metadata backend.driver- metadata bookie driver
-
registerBookieDriver
public static void registerBookieDriver(java.lang.String metadataBackendScheme, java.lang.Class<? extends MetadataBookieDriver> driver, boolean allowOverride)
-
getClientDriver
public static MetadataClientDriver getClientDriver(java.lang.String scheme)
Retrieve the client driver forscheme.- Parameters:
scheme- the scheme for the metadata client driver- Returns:
- the metadata client driver
- Throws:
java.lang.NullPointerException- when scheme is null
-
getClientDriver
public static MetadataClientDriver getClientDriver(java.net.URI uri)
Retrieve the client driver foruri.- Parameters:
uri- the metadata service uri- Returns:
- the metadata client driver for
uri - Throws:
java.lang.NullPointerException- if the metadata serviceuriis null or doesn't have scheme or there is no namespace driver registered for the schemejava.lang.IllegalArgumentException- if the metadata serviceurischeme is illegal
-
getBookieDriver
public static MetadataBookieDriver getBookieDriver(java.lang.String scheme)
Retrieve the bookie driver forscheme.- Parameters:
scheme- the scheme for the metadata bookie driver- Returns:
- the metadata bookie driver
- Throws:
java.lang.NullPointerException- when scheme is null
-
getBookieDriver
public static MetadataBookieDriver getBookieDriver(java.net.URI uri)
Retrieve the bookie driver foruri.- Parameters:
uri- the metadata service uri- Returns:
- the metadata bookie driver for
uri - Throws:
java.lang.NullPointerException- if the metadata serviceuriis null or doesn't have scheme or there is no namespace driver registered for the schemejava.lang.IllegalArgumentException- if the metadata serviceurischeme is illegal
-
runFunctionWithMetadataClientDriver
public static <T> T runFunctionWithMetadataClientDriver(ClientConfiguration conf, java.util.function.Function<MetadataClientDriver,T> function, java.util.concurrent.ScheduledExecutorService executorService) throws MetadataException, java.util.concurrent.ExecutionException
Process the provided function with metadata client driver resolved from the metadata service uri returned byAbstractConfiguration.getMetadataServiceUri().- Parameters:
conf- client configurationfunction- function to apply with metadata client driver.executorService- executor service used by the metadata client driver.- Throws:
MetadataException- when failed to access metadata storejava.util.concurrent.ExecutionException- exception thrown when processing function.
-
runFunctionWithMetadataBookieDriver
public static <T> T runFunctionWithMetadataBookieDriver(ServerConfiguration conf, java.util.function.Function<MetadataBookieDriver,T> function) throws MetadataException, java.util.concurrent.ExecutionException
Process the provided function with metadata bookie driver resolved from the metadata service uri returned byAbstractConfiguration.getMetadataServiceUri().- Parameters:
conf- server configurationfunction- function to apply with metadata bookie driver.- Throws:
MetadataException- when failed to access metadata storejava.util.concurrent.ExecutionException- exception thrown when processing function.
-
runFunctionWithRegistrationManager
public static <T> T runFunctionWithRegistrationManager(ServerConfiguration conf, java.util.function.Function<RegistrationManager,T> function) throws MetadataException, java.util.concurrent.ExecutionException
Process the provided function with registration manager resolved from the metadata service uri returned byAbstractConfiguration.getMetadataServiceUri().- Parameters:
conf- server configurationfunction- function to apply with registration manager.- Throws:
MetadataException- when failed to access metadata storejava.util.concurrent.ExecutionException- exception thrown when processing consumer.
-
runFunctionWithLedgerManagerFactory
public static <T> T runFunctionWithLedgerManagerFactory(ServerConfiguration conf, java.util.function.Function<LedgerManagerFactory,T> function) throws MetadataException, java.util.concurrent.ExecutionException
Process the provided function with ledger manager factory resolved from the metadata service uri returned byAbstractConfiguration.getMetadataServiceUri().- Parameters:
conf- server configurationfunction- function to apply with ledger manager factory.- Throws:
MetadataException- when failed to access metadata storejava.util.concurrent.ExecutionException- exception thrown when processing consumer.
-
getClientDrivers
static java.util.concurrent.ConcurrentMap<java.lang.String,MetadataDrivers.MetadataClientDriverInfo> getClientDrivers()
-
getBookieDrivers
static java.util.concurrent.ConcurrentMap<java.lang.String,MetadataDrivers.MetadataBookieDriverInfo> getBookieDrivers()
-
-