Package org.apache.bookkeeper.mledger
Interface ManagedLedgerFactory
- All Known Implementing Classes:
ManagedLedgerFactoryImpl
@LimitedPrivate
@Stable
public interface ManagedLedgerFactory
A factory to open/create managed ledgers and delete them.
-
Method Summary
Modifier and TypeMethodDescriptionvoidasyncDelete(String name, CompletableFuture<ManagedLedgerConfig> mlConfigFuture, AsyncCallbacks.DeleteLedgerCallback callback, Object ctx) Delete a managed ledger.voidasyncDelete(String name, AsyncCallbacks.DeleteLedgerCallback callback, Object ctx) Delete a managed ledger.asyncExists(String ledgerName) Check managed ledger has been initialized before.voidasyncGetManagedLedgerInfo(String name, AsyncCallbacks.ManagedLedgerInfoCallback callback, Object ctx) Asynchronously get the current metadata info for a managed ledger.voidasyncOpen(String name, AsyncCallbacks.OpenLedgerCallback callback, Object ctx) Asynchronous open method.voidasyncOpen(String name, ManagedLedgerConfig config, AsyncCallbacks.OpenLedgerCallback callback, Supplier<CompletableFuture<Boolean>> mlOwnershipChecker, Object ctx) Asynchronous open method.voidasyncOpenReadOnlyCursor(String managedLedgerName, Position startPosition, ManagedLedgerConfig config, AsyncCallbacks.OpenReadOnlyCursorCallback callback, Object ctx) Open aReadOnlyCursorpositioned to the earliest entry for the specified managed ledger.voidasyncOpenReadOnlyManagedLedger(String managedLedgerName, AsyncCallbacks.OpenReadOnlyManagedLedgerCallback callback, ManagedLedgerConfig config, Object ctx) Asynchronous open a Read-only managedLedger.voidDelete a managed ledger.voiddelete(String name, CompletableFuture<ManagedLedgerConfig> mlConfigFuture) Delete a managed ledger.longgetManagedLedgerInfo(String name) Get the current metadata info for a managed ledger.Open a managed ledger.open(String name, ManagedLedgerConfig config) Open a managed ledger.openReadOnlyCursor(String managedLedgerName, Position startPosition, ManagedLedgerConfig config) Open aReadOnlyCursorpositioned to the earliest entry for the specified managed ledger.voidshutdown()Releases all the resources maintained by the ManagedLedgerFactory.This method tries it's best to releases all the resources maintained by the ManagedLedgerFactory.voidupdateCacheEvictionTimeThreshold(long cacheEvictionTimeThresholdNanos) update cache evictionTimeThreshold.
-
Method Details
-
open
Open a managed ledger. If the managed ledger does not exist, a new one will be automatically created. Uses the default configuration parameters.- Parameters:
name- the unique name that identifies the managed ledger- Returns:
- the managed ledger
- Throws:
ManagedLedgerExceptionInterruptedException
-
open
ManagedLedger open(String name, ManagedLedgerConfig config) throws InterruptedException, ManagedLedgerException Open a managed ledger. If the managed ledger does not exist, a new one will be automatically created.- Parameters:
name- the unique name that identifies the managed ledgerconfig- managed ledger configuration- Returns:
- the managed ledger
- Throws:
ManagedLedgerExceptionInterruptedException
-
asyncOpen
Asynchronous open method.- Parameters:
name- the unique name that identifies the managed ledgercallback- callback objectctx- opaque context- See Also:
-
asyncOpen
void asyncOpen(String name, ManagedLedgerConfig config, AsyncCallbacks.OpenLedgerCallback callback, Supplier<CompletableFuture<Boolean>> mlOwnershipChecker, Object ctx) Asynchronous open method.- Parameters:
name- the unique name that identifies the managed ledgerconfig- managed ledger configurationcallback- callback objectmlOwnershipChecker- checks ml-ownership in case updating ml-metadata fails due to ownership conflictctx- opaque context- See Also:
-
openReadOnlyCursor
ReadOnlyCursor openReadOnlyCursor(String managedLedgerName, Position startPosition, ManagedLedgerConfig config) throws InterruptedException, ManagedLedgerException Open aReadOnlyCursorpositioned to the earliest entry for the specified managed ledger.- Parameters:
managedLedgerName-startPosition- set the cursor on that particular position. If setting to `PositionImpl.earliest` it will be positioned on the first available entry.- Returns:
- Throws:
InterruptedExceptionManagedLedgerException
-
asyncOpenReadOnlyCursor
void asyncOpenReadOnlyCursor(String managedLedgerName, Position startPosition, ManagedLedgerConfig config, AsyncCallbacks.OpenReadOnlyCursorCallback callback, Object ctx) Open aReadOnlyCursorpositioned to the earliest entry for the specified managed ledger.- Parameters:
managedLedgerName-startPosition- set the cursor on that particular position. If setting to `PositionImpl.earliest` it will be positioned on the first available entry.callback-ctx-
-
asyncOpenReadOnlyManagedLedger
void asyncOpenReadOnlyManagedLedger(String managedLedgerName, AsyncCallbacks.OpenReadOnlyManagedLedgerCallback callback, ManagedLedgerConfig config, Object ctx) Asynchronous open a Read-only managedLedger.- Parameters:
managedLedgerName- the unique name that identifies the managed ledgercallback-config- the managed ledger configuration.ctx- opaque context
-
getManagedLedgerInfo
ManagedLedgerInfo getManagedLedgerInfo(String name) throws InterruptedException, ManagedLedgerException Get the current metadata info for a managed ledger.- Parameters:
name- the unique name that identifies the managed ledger- Throws:
InterruptedExceptionManagedLedgerException
-
asyncGetManagedLedgerInfo
void asyncGetManagedLedgerInfo(String name, AsyncCallbacks.ManagedLedgerInfoCallback callback, Object ctx) Asynchronously get the current metadata info for a managed ledger.- Parameters:
name- the unique name that identifies the managed ledgercallback- callback objectctx- opaque context
-
delete
Delete a managed ledger. If it's not open, it's metadata will get regardless deleted.- Parameters:
name-- Throws:
InterruptedExceptionManagedLedgerException
-
delete
void delete(String name, CompletableFuture<ManagedLedgerConfig> mlConfigFuture) throws InterruptedException, ManagedLedgerException Delete a managed ledger. If it's not open, it's metadata will get regardless deleted.- Parameters:
name-- Throws:
InterruptedExceptionManagedLedgerException
-
asyncDelete
Delete a managed ledger. If it's not open, it's metadata will get regardless deleted.- Parameters:
name-- Throws:
InterruptedExceptionManagedLedgerException
-
asyncDelete
void asyncDelete(String name, CompletableFuture<ManagedLedgerConfig> mlConfigFuture, AsyncCallbacks.DeleteLedgerCallback callback, Object ctx) Delete a managed ledger. If it's not open, it's metadata will get regardless deleted.- Parameters:
name-- Throws:
InterruptedExceptionManagedLedgerException
-
shutdown
Releases all the resources maintained by the ManagedLedgerFactory. -
shutdownAsync
This method tries it's best to releases all the resources maintained by the ManagedLedgerFactory. It will take longer time to shutdown than shutdown();- Throws:
ManagedLedgerExceptionInterruptedException- See Also:
-
asyncExists
Check managed ledger has been initialized before. -
getEntryCacheManager
EntryCacheManager getEntryCacheManager()- Returns:
- return EntryCacheManager.
-
updateCacheEvictionTimeThreshold
void updateCacheEvictionTimeThreshold(long cacheEvictionTimeThresholdNanos) update cache evictionTimeThreshold.- Parameters:
cacheEvictionTimeThresholdNanos- time threshold for eviction.
-
getCacheEvictionTimeThreshold
long getCacheEvictionTimeThreshold()- Returns:
- time threshold for eviction.
-
getManagedLedgerPropertiesAsync
- Returns:
- properties of this managedLedger.
-