Package org.apache.pulsar.metadata.impl
Class ZKMetadataStore
- java.lang.Object
-
- org.apache.pulsar.metadata.impl.AbstractMetadataStore
-
- org.apache.pulsar.metadata.impl.batching.AbstractBatchedMetadataStore
-
- org.apache.pulsar.metadata.impl.ZKMetadataStore
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.util.function.Consumer<Notification>,MetadataStoreExtended,MetadataStore,MetadataStoreLifecycle
public class ZKMetadataStore extends AbstractBatchedMetadataStore implements MetadataStoreExtended, MetadataStoreLifecycle
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringZK_SCHEME_IDENTIFIER-
Fields inherited from class org.apache.pulsar.metadata.impl.AbstractMetadataStore
executor
-
-
Constructor Summary
Constructors Constructor Description ZKMetadataStore(java.lang.String metadataURL, MetadataStoreConfig metadataStoreConfig, boolean enableSessionWatcher)ZKMetadataStore(org.apache.zookeeper.ZooKeeper zkc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidbatchOperation(java.util.List<MetadataOp> ops)voidclose()java.util.concurrent.CompletableFuture<java.lang.Boolean>existsFromStore(java.lang.String path)java.lang.StringgetRootPath()org.apache.zookeeper.ZooKeepergetZkClient()longgetZkSessionId()java.util.concurrent.CompletableFuture<java.lang.Void>initializeCluster()Initialize the metadata store cluster if needed.protected voidreceivedSessionEvent(SessionEvent event)-
Methods inherited from class org.apache.pulsar.metadata.impl.batching.AbstractBatchedMetadataStore
getChildrenFromStore, storeDelete, storeGet, storePut
-
Methods inherited from class org.apache.pulsar.metadata.impl.AbstractMetadataStore
accept, delete, deleteRecursive, execute, exists, get, getChildren, getMetadataCache, getMetadataCache, getMetadataCache, invalidateAll, notifyParentChildrenChanged, parent, put, put, receivedNotification, registerListener, registerSessionListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pulsar.metadata.api.MetadataStore
delete, deleteRecursive, exists, get, getChildren, getDefaultMetadataCacheConfig, getMetadataCache, getMetadataCache, getMetadataCache, getMetadataCache, getMetadataCache, getMetadataCache, put, registerListener
-
Methods inherited from interface org.apache.pulsar.metadata.api.extended.MetadataStoreExtended
put, registerSessionListener
-
-
-
-
Field Detail
-
ZK_SCHEME_IDENTIFIER
public static final java.lang.String ZK_SCHEME_IDENTIFIER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ZKMetadataStore
public ZKMetadataStore(java.lang.String metadataURL, MetadataStoreConfig metadataStoreConfig, boolean enableSessionWatcher) throws MetadataStoreException- Throws:
MetadataStoreException
-
ZKMetadataStore
public ZKMetadataStore(org.apache.zookeeper.ZooKeeper zkc)
-
-
Method Detail
-
receivedSessionEvent
protected void receivedSessionEvent(SessionEvent event)
- Overrides:
receivedSessionEventin classAbstractMetadataStore
-
batchOperation
protected void batchOperation(java.util.List<MetadataOp> ops)
- Specified by:
batchOperationin classAbstractBatchedMetadataStore
-
existsFromStore
public java.util.concurrent.CompletableFuture<java.lang.Boolean> existsFromStore(java.lang.String path)
- Specified by:
existsFromStorein classAbstractMetadataStore
-
close
public void close() throws java.lang.Exception- Specified by:
closein interfacejava.lang.AutoCloseable- Overrides:
closein classAbstractBatchedMetadataStore- Throws:
java.lang.Exception
-
getZkSessionId
public long getZkSessionId()
-
getZkClient
public org.apache.zookeeper.ZooKeeper getZkClient()
-
initializeCluster
public java.util.concurrent.CompletableFuture<java.lang.Void> initializeCluster()
Description copied from interface:MetadataStoreLifecycleInitialize the metadata store cluster if needed. For example, if the backend metadata store is a zookeeper cluster and the pulsar cluster is configured to access the zookeeper cluster in the chroot mode, then this method could be used to initialize the root node during pulsar cluster metadata setup.- Specified by:
initializeClusterin interfaceMetadataStoreLifecycle- Returns:
- a future to track the async request.
-
getRootPath
public java.lang.String getRootPath()
-
-