Package org.apache.bookkeeper.meta
Class MetadataDrivers
java.lang.Object
org.apache.bookkeeper.meta.MetadataDrivers
A driver manager for managing a set of metadata drivers.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class(package private) static class -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic MetadataBookieDrivergetBookieDriver(String scheme) Retrieve the bookie driver forscheme.static MetadataBookieDrivergetBookieDriver(URI uri) Retrieve the bookie driver foruri.(package private) static ConcurrentMap<String,MetadataDrivers.MetadataBookieDriverInfo> static MetadataClientDrivergetClientDriver(String scheme) Retrieve the client driver forscheme.static MetadataClientDrivergetClientDriver(URI uri) Retrieve the client driver foruri.(package private) static ConcurrentMap<String,MetadataDrivers.MetadataClientDriverInfo> (package private) static voidstatic voidregisterBookieDriver(String metadataBackendScheme, Class<? extends MetadataBookieDriver> driver) Register the metadata bookiedriver.static voidregisterBookieDriver(String metadataBackendScheme, Class<? extends MetadataBookieDriver> driver, boolean allowOverride) static voidregisterClientDriver(String metadataBackendScheme, Class<? extends MetadataClientDriver> driver) Register the metadata clientdriver.static voidregisterClientDriver(String metadataBackendScheme, Class<? extends MetadataClientDriver> driver, boolean allowOverride) static <T> TrunFunctionWithLedgerManagerFactory(ServerConfiguration conf, 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, 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, Function<MetadataClientDriver, T> function, ScheduledExecutorService executorService) Process the provided function with metadata client driver resolved from the metadata service uri returned byAbstractConfiguration.getMetadataServiceUri().static <T> TrunFunctionWithRegistrationManager(ServerConfiguration conf, Function<RegistrationManager, T> function) Process the provided function with registration manager resolved from the metadata service uri returned byAbstractConfiguration.getMetadataServiceUri().
-
Field Details
-
ZK_CLIENT_DRIVER_CLASS
- See Also:
-
ZK_BOOKIE_DRIVER_CLASS
- See Also:
-
BK_METADATA_CLIENT_DRIVERS_PROPERTY
- See Also:
-
BK_METADATA_BOOKIE_DRIVERS_PROPERTY
- See Also:
-
-
Method Details
-
loadInitialDrivers
static void loadInitialDrivers() -
registerClientDriver
public static void registerClientDriver(String metadataBackendScheme, Class<? extends MetadataClientDriver> driver) Register the metadata clientdriver.- Parameters:
metadataBackendScheme- scheme of metadata backend.driver- metadata client driver
-
registerClientDriver
public static void registerClientDriver(String metadataBackendScheme, Class<? extends MetadataClientDriver> driver, boolean allowOverride) -
registerBookieDriver
public static void registerBookieDriver(String metadataBackendScheme, Class<? extends MetadataBookieDriver> driver) Register the metadata bookiedriver.- Parameters:
metadataBackendScheme- scheme of metadata backend.driver- metadata bookie driver
-
registerBookieDriver
public static void registerBookieDriver(String metadataBackendScheme, Class<? extends MetadataBookieDriver> driver, boolean allowOverride) -
getClientDriver
Retrieve the client driver forscheme.- Parameters:
scheme- the scheme for the metadata client driver- Returns:
- the metadata client driver
- Throws:
NullPointerException- when scheme is null
-
getClientDriver
Retrieve the client driver foruri.- Parameters:
uri- the metadata service uri- Returns:
- the metadata client driver for
uri - Throws:
NullPointerException- if the metadata serviceuriis null or doesn't have scheme or there is no namespace driver registered for the schemeIllegalArgumentException- if the metadata serviceurischeme is illegal
-
getBookieDriver
Retrieve the bookie driver forscheme.- Parameters:
scheme- the scheme for the metadata bookie driver- Returns:
- the metadata bookie driver
- Throws:
NullPointerException- when scheme is null
-
getBookieDriver
Retrieve the bookie driver foruri.- Parameters:
uri- the metadata service uri- Returns:
- the metadata bookie driver for
uri - Throws:
NullPointerException- if the metadata serviceuriis null or doesn't have scheme or there is no namespace driver registered for the schemeIllegalArgumentException- if the metadata serviceurischeme is illegal
-
runFunctionWithMetadataClientDriver
public static <T> T runFunctionWithMetadataClientDriver(ClientConfiguration conf, Function<MetadataClientDriver, T> function, ScheduledExecutorService executorService) throws MetadataException, ExecutionExceptionProcess 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 storeExecutionException- exception thrown when processing function.
-
runFunctionWithMetadataBookieDriver
public static <T> T runFunctionWithMetadataBookieDriver(ServerConfiguration conf, Function<MetadataBookieDriver, T> function) throws MetadataException, ExecutionExceptionProcess 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 storeExecutionException- exception thrown when processing function.
-
runFunctionWithRegistrationManager
public static <T> T runFunctionWithRegistrationManager(ServerConfiguration conf, Function<RegistrationManager, T> function) throws MetadataException, ExecutionExceptionProcess 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 storeExecutionException- exception thrown when processing consumer.
-
runFunctionWithLedgerManagerFactory
public static <T> T runFunctionWithLedgerManagerFactory(ServerConfiguration conf, Function<LedgerManagerFactory, T> function) throws MetadataException, ExecutionExceptionProcess 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 storeExecutionException- exception thrown when processing consumer.
-
getClientDrivers
-
getBookieDrivers
-