@InterfaceAudience.LimitedPrivate
@InterfaceStability.Stable
public interface ManagedCursor
| Modifier and Type | Interface and Description |
|---|---|
static class |
ManagedCursor.FindPositionConstraint |
static class |
ManagedCursor.IndividualDeletedEntries |
| Modifier and Type | Method and Description |
|---|---|
void |
asyncClearBacklog(AsyncCallbacks.ClearBacklogCallback callback,
Object ctx)
Clear the cursor backlog.
|
void |
asyncClose(AsyncCallbacks.CloseCallback callback,
Object ctx)
Close the cursor asynchronously and release the associated resources.
|
void |
asyncDelete(Iterable<Position> position,
AsyncCallbacks.DeleteCallback callback,
Object ctx)
Delete a group of messages asynchronously
Mark a group of messages for deletion.
|
void |
asyncDelete(Position position,
AsyncCallbacks.DeleteCallback callback,
Object ctx)
Delete a single message asynchronously
Mark a single message for deletion.
|
void |
asyncFindNewestMatching(ManagedCursor.FindPositionConstraint constraint,
com.google.common.base.Predicate<Entry> condition,
AsyncCallbacks.FindEntryCallback callback,
Object ctx)
Find the newest entry that matches the given predicate.
|
void |
asyncGetNthEntry(int n,
ManagedCursor.IndividualDeletedEntries deletedEntries,
AsyncCallbacks.ReadEntryCallback callback,
Object ctx)
Asynchronously get 'N'th entry from the mark delete position in the cursor without updating any cursor positions.
|
void |
asyncMarkDelete(Position position,
AsyncCallbacks.MarkDeleteCallback callback,
Object ctx)
Asynchronous mark delete.
|
void |
asyncMarkDelete(Position position,
Map<String,Long> properties,
AsyncCallbacks.MarkDeleteCallback callback,
Object ctx)
Asynchronous mark delete.
|
void |
asyncReadEntries(int numberOfEntriesToRead,
AsyncCallbacks.ReadEntriesCallback callback,
Object ctx,
PositionImpl maxPosition)
Asynchronously read entries from the ManagedLedger.
|
void |
asyncReadEntries(int numberOfEntriesToRead,
long maxSizeBytes,
AsyncCallbacks.ReadEntriesCallback callback,
Object ctx,
PositionImpl maxPosition)
Asynchronously read entries from the ManagedLedger.
|
void |
asyncReadEntriesOrWait(int numberOfEntriesToRead,
AsyncCallbacks.ReadEntriesCallback callback,
Object ctx,
PositionImpl maxPosition)
Asynchronously read entries from the ManagedLedger.
|
void |
asyncReadEntriesOrWait(int maxEntries,
long maxSizeBytes,
AsyncCallbacks.ReadEntriesCallback callback,
Object ctx,
PositionImpl maxPosition)
Asynchronously read entries from the ManagedLedger, up to the specified number and size.
|
Set<? extends Position> |
asyncReplayEntries(Set<? extends Position> positions,
AsyncCallbacks.ReadEntriesCallback callback,
Object ctx)
Read the specified set of positions from ManagedLedger without ordering.
|
Set<? extends Position> |
asyncReplayEntries(Set<? extends Position> positions,
AsyncCallbacks.ReadEntriesCallback callback,
Object ctx,
boolean sortEntries)
Read the specified set of positions from ManagedLedger.
|
void |
asyncResetCursor(Position position,
AsyncCallbacks.ResetCursorCallback callback)
reset the cursor to specified position to enable replay of messages.
|
void |
asyncSkipEntries(int numEntriesToSkip,
ManagedCursor.IndividualDeletedEntries deletedEntries,
AsyncCallbacks.SkipEntriesCallback callback,
Object ctx)
Skip n entries from the read position of this cursor.
|
boolean |
cancelPendingReadRequest()
Cancel a previously scheduled asyncReadEntriesOrWait operation.
|
boolean |
checkAndUpdateReadPositionChanged()
Checks if read position changed since this method was called last time.
|
void |
clearBacklog()
Clear the cursor backlog.
|
void |
close()
Close the cursor and releases the associated resources.
|
void |
delete(Iterable<Position> positions)
Delete a group of entries.
|
void |
delete(Position position)
Delete a single message.
|
Position |
findNewestMatching(ManagedCursor.FindPositionConstraint constraint,
com.google.common.base.Predicate<Entry> condition)
Find the newest entry that matches the given predicate.
|
Position |
findNewestMatching(com.google.common.base.Predicate<Entry> condition)
Find the newest entry that matches the given predicate.
|
long[] |
getDeletedBatchIndexesAsLongArray(PositionImpl position)
Get deleted batch indexes list for a batch message.
|
long |
getEstimatedSizeSinceMarkDeletePosition()
Returns the estimated size of the unacknowledged backlog for this cursor
|
Position |
getFirstPosition()
Get the first position.
|
long |
getLastActive()
Get the last active time of the cursor.
|
com.google.common.collect.Range<PositionImpl> |
getLastIndividualDeletedRange()
Get last individual deleted range
|
ManagedLedger |
getManagedLedger()
Get
ManagedLedger attached with cursor |
Position |
getMarkDeletedPosition()
Get the newest mark deleted position on this cursor.
|
String |
getName()
Get the unique cursor name.
|
int |
getNonContiguousDeletedMessagesRangeSerializedSize()
Returns the serialized size of mark-Delete ranges.
|
Entry |
getNthEntry(int n,
ManagedCursor.IndividualDeletedEntries deletedEntries)
Get 'N'th entry from the mark delete position in the cursor without updating any cursor positions.
|
long |
getNumberOfEntries()
Return the number of messages that this cursor still has to read.
|
long |
getNumberOfEntriesInBacklog(boolean isPrecise)
Return the number of non-deleted messages on this cursor.
|
long |
getNumberOfEntriesSinceFirstNotAckedMessage()
Returns total number of entries from the first not-acked message to current dispatching position.
|
Position |
getPersistentMarkDeletedPosition()
Get the persistent newest mark deleted position on this cursor.
|
Map<String,Long> |
getProperties()
Return any properties that were associated with the last stored position.
|
Position |
getReadPosition()
Get the read position.
|
ManagedCursorMXBean |
getStats() |
double |
getThrottleMarkDelete()
Returns cursor throttle mark-delete rate.
|
int |
getTotalNonContiguousDeletedMessagesRange()
Returns number of mark-Delete range.
|
boolean |
hasMoreEntries()
Tells whether this cursor has already consumed all the available entries.
|
boolean |
isActive()
Checks if cursor is active or not.
|
boolean |
isDurable()
Tells whether the cursor is durable or just kept in memory.
|
void |
markDelete(Position position)
This signals that the reader is done with all the entries up to "position" (included).
|
void |
markDelete(Position position,
Map<String,Long> properties)
This signals that the reader is done with all the entries up to "position" (included).
|
boolean |
putProperty(String key,
Long value)
Add a property associated with the last stored position.
|
List<Entry> |
readEntries(int numberOfEntriesToRead)
Read entries from the ManagedLedger, up to the specified number.
|
List<Entry> |
readEntriesOrWait(int numberOfEntriesToRead)
Read entries from the ManagedLedger, up to the specified number.
|
List<Entry> |
readEntriesOrWait(int maxEntries,
long maxSizeBytes)
Read entries from the ManagedLedger, up to the specified number and size.
|
boolean |
removeProperty(String key)
Remove a property associated with the last stored position.
|
List<Entry> |
replayEntries(Set<? extends Position> positions)
Read the specified set of positions from ManagedLedger.
|
void |
resetCursor(Position position)
reset the cursor to specified position to enable replay of messages.
|
void |
rewind()
Rewind the cursor to the mark deleted position to replay all the already read but not yet mark deleted messages.
|
default void |
seek(Position newReadPosition)
Move the cursor to a different read position.
|
void |
seek(Position newReadPosition,
boolean force) |
void |
setActive()
Activate cursor: EntryCacheManager caches entries only for activated-cursors.
|
void |
setAlwaysInactive()
A cursor that is set as always-inactive will never trigger the caching of
entries.
|
void |
setInactive()
Deactivate cursor.
|
void |
setThrottleMarkDelete(double throttleMarkDelete)
Update throttle mark delete rate.
|
void |
skipEntries(int numEntriesToSkip,
ManagedCursor.IndividualDeletedEntries deletedEntries)
Skip n entries from the read position of this cursor.
|
void |
trimDeletedEntries(List<Entry> entries)
Trim delete entries for the given entries
|
void |
updateLastActive()
Update the last active time of the cursor
|
String getName()
long getLastActive()
void updateLastActive()
Map<String,Long> getProperties()
boolean putProperty(String key, Long value)
boolean removeProperty(String key)
List<Entry> readEntries(int numberOfEntriesToRead) throws InterruptedException, ManagedLedgerException
numberOfEntriesToRead - maximum number of entries to returnManagedLedgerExceptionInterruptedExceptionvoid asyncReadEntries(int numberOfEntriesToRead,
AsyncCallbacks.ReadEntriesCallback callback,
Object ctx,
PositionImpl maxPosition)
numberOfEntriesToRead - maximum number of entries to returncallback - callback objectctx - opaque contextmaxPosition - max position can readreadEntries(int)void asyncReadEntries(int numberOfEntriesToRead,
long maxSizeBytes,
AsyncCallbacks.ReadEntriesCallback callback,
Object ctx,
PositionImpl maxPosition)
numberOfEntriesToRead - maximum number of entries to returnmaxSizeBytes - max size in bytes of the entries to returncallback - callback objectctx - opaque contextmaxPosition - max position can readEntry getNthEntry(int n, ManagedCursor.IndividualDeletedEntries deletedEntries) throws InterruptedException, ManagedLedgerException
n - entry positiondeletedEntries - skip individual deleted entriesInterruptedExceptionManagedLedgerExceptionvoid asyncGetNthEntry(int n,
ManagedCursor.IndividualDeletedEntries deletedEntries,
AsyncCallbacks.ReadEntryCallback callback,
Object ctx)
n - entry positiondeletedEntries - skip individual deleted entriescallback - ctx - List<Entry> readEntriesOrWait(int numberOfEntriesToRead) throws InterruptedException, ManagedLedgerException
numberOfEntriesToRead - maximum number of entries to returnManagedLedgerExceptionInterruptedExceptionList<Entry> readEntriesOrWait(int maxEntries, long maxSizeBytes) throws InterruptedException, ManagedLedgerException
maxEntries - maximum number of entries to returnmaxSizeBytes - max size in bytes of the entries to returnManagedLedgerExceptionInterruptedExceptionvoid asyncReadEntriesOrWait(int numberOfEntriesToRead,
AsyncCallbacks.ReadEntriesCallback callback,
Object ctx,
PositionImpl maxPosition)
numberOfEntriesToRead - maximum number of entries to returncallback - callback objectctx - opaque contextmaxPosition - max position can readreadEntriesOrWait(int)void asyncReadEntriesOrWait(int maxEntries,
long maxSizeBytes,
AsyncCallbacks.ReadEntriesCallback callback,
Object ctx,
PositionImpl maxPosition)
maxEntries - maximum number of entries to returnmaxSizeBytes - max size in bytes of the entries to returncallback - callback objectctx - opaque contextmaxPosition - max position can readreadEntriesOrWait(int, long)boolean cancelPendingReadRequest()
#asyncReadEntriesOrWait(int, ReadEntriesCallback, Object, PositionImpl)boolean hasMoreEntries()
long getNumberOfEntries()
long getNumberOfEntriesInBacklog(boolean isPrecise)
isPrecise - set to true to get precise backlog countvoid markDelete(Position position) throws InterruptedException, ManagedLedgerException
position - the last position that have been successfully consumedManagedLedgerExceptionInterruptedExceptionvoid markDelete(Position position, Map<String,Long> properties) throws InterruptedException, ManagedLedgerException
position - the last position that have been successfully consumedproperties - additional user-defined properties that can be associated with a particular cursor positionManagedLedgerExceptionInterruptedExceptionvoid asyncMarkDelete(Position position, AsyncCallbacks.MarkDeleteCallback callback, Object ctx)
position - the last position that have been successfully consumedcallback - callback objectctx - opaque contextmarkDelete(Position)void asyncMarkDelete(Position position, Map<String,Long> properties, AsyncCallbacks.MarkDeleteCallback callback, Object ctx)
position - the last position that have been successfully consumedproperties - additional user-defined properties that can be associated with a particular cursor positioncallback - callback objectctx - opaque contextmarkDelete(Position)void delete(Position position) throws InterruptedException, ManagedLedgerException
position - the position of the message to be deletedInterruptedExceptionManagedLedgerExceptionvoid asyncDelete(Position position, AsyncCallbacks.DeleteCallback callback, Object ctx)
position - the position of the message to be deletedcallback - callback objectctx - opaque contextvoid delete(Iterable<Position> positions) throws InterruptedException, ManagedLedgerException
positions - positions of the messages to be deletedInterruptedExceptionManagedLedgerExceptionvoid asyncDelete(Iterable<Position> position, AsyncCallbacks.DeleteCallback callback, Object ctx)
position - the positions of the messages to be deletedcallback - callback objectctx - opaque contextPosition getReadPosition()
Position getMarkDeletedPosition()
Position getPersistentMarkDeletedPosition()
void rewind()
default void seek(Position newReadPosition)
newReadPosition - the position where to move the cursorvoid seek(Position newReadPosition, boolean force)
void clearBacklog()
throws InterruptedException,
ManagedLedgerException
void asyncClearBacklog(AsyncCallbacks.ClearBacklogCallback callback, Object ctx)
callback - callback objectctx - opaque contextvoid skipEntries(int numEntriesToSkip,
ManagedCursor.IndividualDeletedEntries deletedEntries)
throws InterruptedException,
ManagedLedgerException
numEntriesToSkip - number of entries to skipdeletedEntries - skip individual deleted entriesInterruptedExceptionManagedLedgerExceptionvoid asyncSkipEntries(int numEntriesToSkip,
ManagedCursor.IndividualDeletedEntries deletedEntries,
AsyncCallbacks.SkipEntriesCallback callback,
Object ctx)
numEntriesToSkip - number of entries to skipdeletedEntries - skip individual deleted entriescallback - callback objectctx - opaque contextPosition findNewestMatching(com.google.common.base.Predicate<Entry> condition) throws InterruptedException, ManagedLedgerException
condition - predicate that reads an entry an applies a conditionInterruptedExceptionManagedLedgerExceptionPosition findNewestMatching(ManagedCursor.FindPositionConstraint constraint, com.google.common.base.Predicate<Entry> condition) throws InterruptedException, ManagedLedgerException
constraint - search only active entries or all entriescondition - predicate that reads an entry an applies a conditionInterruptedExceptionManagedLedgerExceptionvoid asyncFindNewestMatching(ManagedCursor.FindPositionConstraint constraint, com.google.common.base.Predicate<Entry> condition, AsyncCallbacks.FindEntryCallback callback, Object ctx)
constraint - search only active entries or all entriescondition - predicate that reads an entry an applies a conditioncallback - callback object returning the resultant positionctx - opaque contextvoid resetCursor(Position position) throws InterruptedException, ManagedLedgerException
position - position to move the cursor toInterruptedExceptionManagedLedgerExceptionvoid asyncResetCursor(Position position, AsyncCallbacks.ResetCursorCallback callback)
position - position to move the cursor tocallback - callback objectList<Entry> replayEntries(Set<? extends Position> positions) throws InterruptedException, ManagedLedgerException
positions - set of positions to readInterruptedExceptionManagedLedgerExceptionSet<? extends Position> asyncReplayEntries(Set<? extends Position> positions, AsyncCallbacks.ReadEntriesCallback callback, Object ctx)
positions - set of positions to readcallback - callback object returning the list of entriesctx - opaque contextSet<? extends Position> asyncReplayEntries(Set<? extends Position> positions, AsyncCallbacks.ReadEntriesCallback callback, Object ctx, boolean sortEntries)
positions - set of positions to readcallback - callback object returning the list of entriesctx - opaque contextsortEntries - callback with sorted entry list.void close()
throws InterruptedException,
ManagedLedgerException
void asyncClose(AsyncCallbacks.CloseCallback callback, Object ctx)
callback - callback objectctx - opaque contextPosition getFirstPosition()
void setActive()
void setInactive()
void setAlwaysInactive()
boolean isActive()
boolean isDurable()
long getNumberOfEntriesSinceFirstNotAckedMessage()
int getTotalNonContiguousDeletedMessagesRange()
int getNonContiguousDeletedMessagesRangeSerializedSize()
long getEstimatedSizeSinceMarkDeletePosition()
double getThrottleMarkDelete()
void setThrottleMarkDelete(double throttleMarkDelete)
ManagedLedger getManagedLedger()
ManagedLedger attached with cursorcom.google.common.collect.Range<PositionImpl> getLastIndividualDeletedRange()
void trimDeletedEntries(List<Entry> entries)
long[] getDeletedBatchIndexesAsLongArray(PositionImpl position)
ManagedCursorMXBean getStats()
boolean checkAndUpdateReadPositionChanged()
Copyright © 2017–2021 Apache Software Foundation. All rights reserved.