@InterfaceAudience.LimitedPrivate
@InterfaceStability.Stable
public interface ManagedLedger
ManagedCursor), each of them with an associated position| Modifier and Type | Method and Description |
|---|---|
Position |
addEntry(byte[] data)
Append a new entry to the end of a managed ledger.
|
Position |
addEntry(byte[] data,
int numberOfMessages)
Append a new entry to the end of a managed ledger.
|
Position |
addEntry(byte[] data,
int offset,
int length)
Append a new entry to the end of a managed ledger.
|
Position |
addEntry(byte[] data,
int numberOfMessages,
int offset,
int length)
Append a new entry to the end of a managed ledger.
|
void |
asyncAddEntry(byte[] data,
AsyncCallbacks.AddEntryCallback callback,
Object ctx)
Append a new entry asynchronously.
|
void |
asyncAddEntry(byte[] data,
int offset,
int length,
AsyncCallbacks.AddEntryCallback callback,
Object ctx)
Append a new entry asynchronously.
|
void |
asyncAddEntry(byte[] data,
int numberOfMessages,
int offset,
int length,
AsyncCallbacks.AddEntryCallback callback,
Object ctx)
Append a new entry asynchronously.
|
void |
asyncAddEntry(io.netty.buffer.ByteBuf buffer,
AsyncCallbacks.AddEntryCallback callback,
Object ctx)
Append a new entry asynchronously.
|
void |
asyncAddEntry(io.netty.buffer.ByteBuf buffer,
int numberOfMessages,
AsyncCallbacks.AddEntryCallback callback,
Object ctx)
Append a new entry asynchronously.
|
void |
asyncClose(AsyncCallbacks.CloseCallback callback,
Object ctx)
Close the ManagedLedger asynchronously.
|
void |
asyncDelete(AsyncCallbacks.DeleteLedgerCallback callback,
Object ctx)
Async delete a ledger.
|
void |
asyncDeleteCursor(String name,
AsyncCallbacks.DeleteCursorCallback callback,
Object ctx)
Delete a ManagedCursor asynchronously.
|
void |
asyncDeleteProperty(String key,
AsyncCallbacks.UpdatePropertiesCallback callback,
Object ctx)
Async delete the property by key.
|
CompletableFuture<Position> |
asyncFindPosition(com.google.common.base.Predicate<Entry> predicate)
Find position by sequenceId.
|
void |
asyncOffloadPrefix(Position pos,
AsyncCallbacks.OffloadCallback callback,
Object ctx)
Offload as many entries before position as possible to longterm storage.
|
void |
asyncOpenCursor(String name,
AsyncCallbacks.OpenCursorCallback callback,
Object ctx)
Open a ManagedCursor asynchronously.
|
void |
asyncOpenCursor(String name,
CommandSubscribe.InitialPosition initialPosition,
AsyncCallbacks.OpenCursorCallback callback,
Object ctx)
Open a ManagedCursor asynchronously.
|
void |
asyncOpenCursor(String name,
CommandSubscribe.InitialPosition initialPosition,
Map<String,Long> properties,
AsyncCallbacks.OpenCursorCallback callback,
Object ctx)
Open a ManagedCursor asynchronously.
|
void |
asyncSetProperties(Map<String,String> properties,
AsyncCallbacks.UpdatePropertiesCallback callback,
Object ctx)
Async update managed-ledger's properties.
|
void |
asyncSetProperty(String key,
String value,
AsyncCallbacks.UpdatePropertiesCallback callback,
Object ctx)
Async add key-value to propertiesMap.
|
void |
asyncTerminate(AsyncCallbacks.TerminateCallback callback,
Object ctx) |
CompletableFuture<Void> |
asyncTruncate()
Truncate ledgers
The truncate operation will move all cursors to the end of the topic and delete all inactive ledgers.
|
void |
close()
Close the ManagedLedger.
|
void |
delete()
Delete the ManagedLedger.
|
void |
deleteCursor(String name)
Remove a ManagedCursor from this ManagedLedger.
|
void |
deleteProperty(String key)
Delete the property by key.
|
Iterable<ManagedCursor> |
getActiveCursors()
Get a list of all the active cursors reading from this ManagedLedger.
|
ManagedLedgerConfig |
getConfig()
Returns managed-ledger config.
|
Iterable<ManagedCursor> |
getCursors()
Get a list of all the cursors reading from this ManagedLedger
|
long |
getEstimatedBacklogSize()
Get estimated total unconsumed or backlog size in bytes for the managed ledger, without accounting for replicas.
|
Position |
getLastConfirmedEntry()
Gets last confirmed entry of the managed ledger.
|
CompletableFuture<MLDataFormats.ManagedLedgerInfo.LedgerInfo> |
getLedgerInfo(long ledgerId)
Get basic ledger summary.
|
ManagedLedgerInterceptor |
getManagedLedgerInterceptor()
Get the ManagedLedgerInterceptor for ManagedLedger.
|
CompletableFuture<ManagedLedgerInternalStats> |
getManagedLedgerInternalStats(boolean includeLedgerMetadata)
Get managed ledger internal stats
|
String |
getName() |
long |
getNumberOfActiveEntries()
Get the total number of active entries for this managed ledger.
|
long |
getNumberOfEntries()
Get the total number of entries for this managed ledger.
|
long |
getOffloadedSize()
Return the size of all ledgers offloaded to 2nd tier storage
|
Map<String,String> |
getProperties()
Returns managed-ledger's properties.
|
ManagedCursor |
getSlowestConsumer()
Get the slowest consumer.
|
ManagedLedgerMXBean |
getStats() |
long |
getTotalSize()
Get the total sizes in bytes of the managed ledger, without accounting for replicas.
|
boolean |
isTerminated()
Returns whether the managed ledger was terminated.
|
ManagedCursor |
newNonDurableCursor(Position startCursorPosition)
Creates a new cursor whose metadata is not backed by durable storage.
|
ManagedCursor |
newNonDurableCursor(Position startPosition,
String subscriptionName) |
ManagedCursor |
newNonDurableCursor(Position startPosition,
String subscriptionName,
CommandSubscribe.InitialPosition initialPosition) |
Position |
offloadPrefix(Position pos)
Offload as many entries before position as possible to longterm storage.
|
ManagedCursor |
openCursor(String name)
Open a ManagedCursor in this ManagedLedger.
|
ManagedCursor |
openCursor(String name,
CommandSubscribe.InitialPosition initialPosition)
Open a ManagedCursor in this ManagedLedger.
|
ManagedCursor |
openCursor(String name,
CommandSubscribe.InitialPosition initialPosition,
Map<String,Long> properties)
Open a ManagedCursor in this ManagedLedger.
|
void |
readyToCreateNewLedger()
Signaling managed ledger that we can resume after BK write failure
|
void |
rollCurrentLedgerIfFull()
Deprecated.
|
void |
setConfig(ManagedLedgerConfig config)
Updates managed-ledger config.
|
void |
setProperties(Map<String,String> properties)
Update managed-ledger's properties.
|
void |
setProperty(String key,
String value)
Add key-value to propertiesMap.
|
Position |
terminate()
Terminate the managed ledger and return the last committed entry.
|
void |
trimConsumedLedgersInBackground(CompletableFuture<?> promise)
Trim consumed ledgers in background
|
String getName()
Position addEntry(byte[] data) throws InterruptedException, ManagedLedgerException
data - data entry to be persistedManagedLedgerExceptionInterruptedExceptionPosition addEntry(byte[] data, int numberOfMessages) throws InterruptedException, ManagedLedgerException
data - data entry to be persistednumberOfMessages - numberOfMessages of entryManagedLedgerExceptionInterruptedExceptionvoid asyncAddEntry(byte[] data,
AsyncCallbacks.AddEntryCallback callback,
Object ctx)
data - data entry to be persistedcallback - callback objectctx - opaque contextaddEntry(byte[])Position addEntry(byte[] data, int offset, int length) throws InterruptedException, ManagedLedgerException
data - data entry to be persistedoffset - offset in the data arraylength - number of bytesManagedLedgerExceptionInterruptedExceptionPosition addEntry(byte[] data, int numberOfMessages, int offset, int length) throws InterruptedException, ManagedLedgerException
data - data entry to be persistednumberOfMessages - numberOfMessages of entryoffset - offset in the data arraylength - number of bytesManagedLedgerExceptionInterruptedExceptionvoid asyncAddEntry(byte[] data,
int offset,
int length,
AsyncCallbacks.AddEntryCallback callback,
Object ctx)
data - data entry to be persistedoffset - offset in the data arraylength - number of bytescallback - callback objectctx - opaque contextaddEntry(byte[])void asyncAddEntry(byte[] data,
int numberOfMessages,
int offset,
int length,
AsyncCallbacks.AddEntryCallback callback,
Object ctx)
data - data entry to be persistednumberOfMessages - numberOfMessages of entryoffset - offset in the data arraylength - number of bytescallback - callback objectctx - opaque contextaddEntry(byte[])void asyncAddEntry(io.netty.buffer.ByteBuf buffer,
AsyncCallbacks.AddEntryCallback callback,
Object ctx)
buffer - buffer with the data entrycallback - callback objectctx - opaque contextaddEntry(byte[])void asyncAddEntry(io.netty.buffer.ByteBuf buffer,
int numberOfMessages,
AsyncCallbacks.AddEntryCallback callback,
Object ctx)
buffer - buffer with the data entrynumberOfMessages - numberOfMessages for data entrycallback - callback objectctx - opaque contextaddEntry(byte[])ManagedCursor openCursor(String name) throws InterruptedException, ManagedLedgerException
name - the name associated with the ManagedCursorManagedLedgerExceptionInterruptedExceptionManagedCursor openCursor(String name, CommandSubscribe.InitialPosition initialPosition) throws InterruptedException, ManagedLedgerException
If the cursors doesn't exist, a new one will be created and its position will be at the end of the ManagedLedger.
name - the name associated with the ManagedCursorinitialPosition - the cursor will be set at latest position or not when first created
default is trueManagedLedgerExceptionInterruptedExceptionManagedCursor openCursor(String name, CommandSubscribe.InitialPosition initialPosition, Map<String,Long> properties) throws InterruptedException, ManagedLedgerException
If the cursors doesn't exist, a new one will be created and its position will be at the end of the ManagedLedger.
name - the name associated with the ManagedCursorinitialPosition - the cursor will be set at latest position or not when first created
default is trueproperties - user defined properties that will be attached to the first position of the cursor, if the open
operation will trigger the creation of the cursor.ManagedLedgerExceptionInterruptedExceptionManagedCursor newNonDurableCursor(Position startCursorPosition) throws ManagedLedgerException
startCursorPosition - the position where the cursor should be initialized, or null to start from the current latest entry.
When starting on a particular cursor position, the first entry to be returned will be the entry next
to the specified positionManagedLedgerExceptionManagedCursor newNonDurableCursor(Position startPosition, String subscriptionName) throws ManagedLedgerException
ManagedLedgerExceptionManagedCursor newNonDurableCursor(Position startPosition, String subscriptionName, CommandSubscribe.InitialPosition initialPosition) throws ManagedLedgerException
ManagedLedgerExceptionvoid asyncDeleteCursor(String name, AsyncCallbacks.DeleteCursorCallback callback, Object ctx)
name - the name associated with the ManagedCursorcallback - callback objectctx - opaque contextdeleteCursor(String)void deleteCursor(String name) throws InterruptedException, ManagedLedgerException
name - the name associated with the ManagedCursorManagedLedgerExceptionInterruptedExceptionvoid asyncOpenCursor(String name, AsyncCallbacks.OpenCursorCallback callback, Object ctx)
name - the name associated with the ManagedCursorcallback - callback objectctx - opaque contextopenCursor(String)void asyncOpenCursor(String name, CommandSubscribe.InitialPosition initialPosition, AsyncCallbacks.OpenCursorCallback callback, Object ctx)
name - the name associated with the ManagedCursorinitialPosition - the cursor will be set at lastest position or not when first created
default is truecallback - callback objectctx - opaque contextopenCursor(String)void asyncOpenCursor(String name, CommandSubscribe.InitialPosition initialPosition, Map<String,Long> properties, AsyncCallbacks.OpenCursorCallback callback, Object ctx)
name - the name associated with the ManagedCursorinitialPosition - the cursor will be set at lastest position or not when first created
default is truecallback - callback objectctx - opaque contextopenCursor(String)Iterable<ManagedCursor> getCursors()
Iterable<ManagedCursor> getActiveCursors()
long getNumberOfEntries()
long getNumberOfActiveEntries()
long getTotalSize()
long getEstimatedBacklogSize()
long getOffloadedSize()
void asyncTerminate(AsyncCallbacks.TerminateCallback callback, Object ctx)
Position terminate() throws InterruptedException, ManagedLedgerException
InterruptedExceptionManagedLedgerExceptionvoid close()
throws InterruptedException,
ManagedLedgerException
void asyncClose(AsyncCallbacks.CloseCallback callback, Object ctx)
callback - callback objectctx - opaque contextclose()ManagedLedgerMXBean getStats()
void delete()
throws InterruptedException,
ManagedLedgerException
void asyncDelete(AsyncCallbacks.DeleteLedgerCallback callback, Object ctx)
callback - ctx - InterruptedExceptionManagedLedgerExceptionPosition offloadPrefix(Position pos) throws InterruptedException, ManagedLedgerException
pos - the position before which entries will be offloadedInterruptedExceptionManagedLedgerException#asyncOffloadPrefix(Position,OffloadCallback,Object)void asyncOffloadPrefix(Position pos, AsyncCallbacks.OffloadCallback callback, Object ctx)
pos - the position before which entries will be offloadedcallback - a callback which will be supplied with the earliest unoffloaded position on
completionctx - a context object which will be passed to the callback on completionManagedCursor getSlowestConsumer()
boolean isTerminated()
ManagedLedgerConfig getConfig()
void setConfig(ManagedLedgerConfig config)
config - Position getLastConfirmedEntry()
void readyToCreateNewLedger()
Map<String,String> getProperties()
void setProperty(String key, String value) throws InterruptedException, ManagedLedgerException
key - key of property to addvalue - value of property to addInterruptedExceptionManagedLedgerExceptionvoid asyncSetProperty(String key, String value, AsyncCallbacks.UpdatePropertiesCallback callback, Object ctx)
key - key of property to addvalue - value of property to addcallback - a callback which will be supplied with the newest properties in managedLedger.ctx - a context object which will be passed to the callback on completion.void deleteProperty(String key) throws InterruptedException, ManagedLedgerException
key - key of property to deleteInterruptedExceptionManagedLedgerExceptionvoid asyncDeleteProperty(String key, AsyncCallbacks.UpdatePropertiesCallback callback, Object ctx)
key - key of property to deletecallback - a callback which will be supplied with the newest properties in managedLedger.ctx - a context object which will be passed to the callback on completion.void setProperties(Map<String,String> properties) throws InterruptedException, ManagedLedgerException
properties - key-values of propertiesInterruptedExceptionManagedLedgerExceptionvoid asyncSetProperties(Map<String,String> properties, AsyncCallbacks.UpdatePropertiesCallback callback, Object ctx)
properties - key-values of properties.callback - a callback which will be supplied with the newest properties in managedLedger.ctx - a context object which will be passed to the callback on completion.void trimConsumedLedgersInBackground(CompletableFuture<?> promise)
promise - @Deprecated void rollCurrentLedgerIfFull()
CompletableFuture<Position> asyncFindPosition(com.google.common.base.Predicate<Entry> predicate)
ManagedLedgerInterceptor getManagedLedgerInterceptor()
CompletableFuture<MLDataFormats.ManagedLedgerInfo.LedgerInfo> getLedgerInfo(long ledgerId)
CompletableFuture<Void> asyncTruncate()
CompletableFuture<ManagedLedgerInternalStats> getManagedLedgerInternalStats(boolean includeLedgerMetadata)
includeLedgerMetadata - the flag to control managed ledger internal stats include ledger metadataCopyright © 2017–2021 Apache Software Foundation. All rights reserved.