Class MetaStoreImpl
java.lang.Object
org.apache.bookkeeper.mledger.impl.MetaStoreImpl
- All Implemented Interfaces:
Consumer<Notification>,MetaStore
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.bookkeeper.mledger.impl.MetaStore
MetaStore.MetaStoreCallback<T>, MetaStore.UpdateCallback<T>, MetaStore.UpdateLedgersIdsCallback -
Constructor Summary
ConstructorsConstructorDescriptionMetaStoreImpl(MetadataStore store, org.apache.bookkeeper.common.util.OrderedExecutor executor) MetaStoreImpl(MetadataStore store, org.apache.bookkeeper.common.util.OrderedExecutor executor, MetadataCompressionConfig ledgerInfoCompressionConfig, MetadataCompressionConfig cursorInfoCompressionConfig) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(Notification notification) asyncExists(String path) Check ledger exists.voidasyncGetCursorInfo(String ledgerName, String cursorName, MetaStore.MetaStoreCallback<MLDataFormats.ManagedCursorInfo> callback) Get the ledger id associated with a cursor.voidasyncRemoveCursor(String ledgerName, String cursorName, MetaStore.MetaStoreCallback<Void> callback) Drop the persistent state of a consumer from the metadata store.voidasyncUpdateCursorInfo(String ledgerName, String cursorName, MLDataFormats.ManagedCursorInfo info, Stat stat, MetaStore.MetaStoreCallback<Void> callback) Update the persisted position of a cursor.voidasyncUpdateLedgerIds(String ledgerName, MLDataFormats.ManagedLedgerInfo mlInfo, Stat stat, MetaStore.MetaStoreCallback<Void> callback) byte[]compressCursorInfo(MLDataFormats.ManagedCursorInfo managedCursorInfo) byte[]compressLedgerInfo(MLDataFormats.ManagedLedgerInfo managedLedgerInfo) voidgetCursors(String ledgerName, MetaStore.MetaStoreCallback<List<String>> callback) Get the list of cursors registered on a ManagedLedger.voidgetManagedLedgerInfo(String ledgerName, boolean createIfMissing, Map<String, String> properties, MetaStore.MetaStoreCallback<MLDataFormats.ManagedLedgerInfo> callback) Get the metadata used by the ManagedLedger.Get managed ledger properties from meta store.Get a list of all the managed ledgers in the system.parseManagedCursorInfo(byte[] data) parseManagedLedgerInfo(byte[] data) voidremoveManagedLedger(String ledgerName, MetaStore.MetaStoreCallback<Void> callback) Drop the persistent state for the ManagedLedger and all its associated consumers.voidunwatchManagedLedgerInfo(String ledgerName) Unwatch the metadata changes for ledgerName.voidwatchManagedLedgerInfo(String ledgerName, MetaStore.UpdateCallback<MLDataFormats.ManagedLedgerInfo> callback) Watch the metadata used by the ManagedLedger.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.bookkeeper.mledger.impl.MetaStore
getManagedLedgerInfo
-
Constructor Details
-
MetaStoreImpl
public MetaStoreImpl(MetadataStore store, org.apache.bookkeeper.common.util.OrderedExecutor executor) -
MetaStoreImpl
public MetaStoreImpl(MetadataStore store, org.apache.bookkeeper.common.util.OrderedExecutor executor, MetadataCompressionConfig ledgerInfoCompressionConfig, MetadataCompressionConfig cursorInfoCompressionConfig)
-
-
Method Details
-
getManagedLedgerInfo
public void getManagedLedgerInfo(String ledgerName, boolean createIfMissing, Map<String, String> properties, MetaStore.MetaStoreCallback<MLDataFormats.ManagedLedgerInfo> callback) Description copied from interface:MetaStoreGet the metadata used by the ManagedLedger.- Specified by:
getManagedLedgerInfoin interfaceMetaStore- Parameters:
ledgerName- the name of the ManagedLedgercreateIfMissing- whether the managed ledger metadata should be created if it doesn't exist alreadyproperties- ledger properties
-
getManagedLedgerPropertiesAsync
Description copied from interface:MetaStoreGet managed ledger properties from meta store.- Specified by:
getManagedLedgerPropertiesAsyncin interfaceMetaStore- Parameters:
name- ledgerName- Returns:
- a future represents the result of the operation.
-
asyncUpdateLedgerIds
public void asyncUpdateLedgerIds(String ledgerName, MLDataFormats.ManagedLedgerInfo mlInfo, Stat stat, MetaStore.MetaStoreCallback<Void> callback) - Specified by:
asyncUpdateLedgerIdsin interfaceMetaStore- Parameters:
ledgerName- the name of the ManagedLedgermlInfo- managed ledger infostat- version object associated with current statecallback- callback object
-
getCursors
Description copied from interface:MetaStoreGet the list of cursors registered on a ManagedLedger.- Specified by:
getCursorsin interfaceMetaStore- Parameters:
ledgerName- the name of the ManagedLedger
-
asyncGetCursorInfo
public void asyncGetCursorInfo(String ledgerName, String cursorName, MetaStore.MetaStoreCallback<MLDataFormats.ManagedCursorInfo> callback) Description copied from interface:MetaStoreGet the ledger id associated with a cursor. This ledger id will contains the mark-deleted position for the cursor.- Specified by:
asyncGetCursorInfoin interfaceMetaStore
-
asyncUpdateCursorInfo
public void asyncUpdateCursorInfo(String ledgerName, String cursorName, MLDataFormats.ManagedCursorInfo info, Stat stat, MetaStore.MetaStoreCallback<Void> callback) Description copied from interface:MetaStoreUpdate the persisted position of a cursor.- Specified by:
asyncUpdateCursorInfoin interfaceMetaStore- Parameters:
ledgerName- the name of the ManagedLedgercallback- the callback
-
asyncRemoveCursor
public void asyncRemoveCursor(String ledgerName, String cursorName, MetaStore.MetaStoreCallback<Void> callback) Description copied from interface:MetaStoreDrop the persistent state of a consumer from the metadata store.- Specified by:
asyncRemoveCursorin interfaceMetaStore- Parameters:
ledgerName- the name of the ManagedLedgercursorName- the cursor namecallback- callback object
-
removeManagedLedger
Description copied from interface:MetaStoreDrop the persistent state for the ManagedLedger and all its associated consumers.- Specified by:
removeManagedLedgerin interfaceMetaStore- Parameters:
ledgerName- the name of the ManagedLedgercallback- callback object
-
getManagedLedgers
Description copied from interface:MetaStoreGet a list of all the managed ledgers in the system.- Specified by:
getManagedLedgersin interfaceMetaStore- Returns:
- an Iterable of the names of the managed ledgers
- Throws:
ManagedLedgerException.MetaStoreException
-
asyncExists
Description copied from interface:MetaStoreCheck ledger exists.- Specified by:
asyncExistsin interfaceMetaStore- Parameters:
path-String- Returns:
- a future represents the result of the operation.
an instance of
Booleanis returned if the operation succeeds.
-
watchManagedLedgerInfo
public void watchManagedLedgerInfo(String ledgerName, MetaStore.UpdateCallback<MLDataFormats.ManagedLedgerInfo> callback) Description copied from interface:MetaStoreWatch the metadata used by the ManagedLedger.- Specified by:
watchManagedLedgerInfoin interfaceMetaStore
-
unwatchManagedLedgerInfo
Description copied from interface:MetaStoreUnwatch the metadata changes for ledgerName.- Specified by:
unwatchManagedLedgerInfoin interfaceMetaStore
-
accept
- Specified by:
acceptin interfaceConsumer<Notification>
-
compressLedgerInfo
-
compressCursorInfo
-
parseManagedLedgerInfo
public MLDataFormats.ManagedLedgerInfo parseManagedLedgerInfo(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-
parseManagedCursorInfo
public MLDataFormats.ManagedCursorInfo parseManagedCursorInfo(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException - Throws:
com.google.protobuf.InvalidProtocolBufferException
-