@InterfaceAudience.LimitedPrivate
@InterfaceStability.Stable
public interface ReadOnlyCursor
| Modifier and Type | Method and Description |
|---|---|
void |
asyncClose(AsyncCallbacks.CloseCallback callback,
Object ctx)
Close the cursor asynchronously and release the associated resources.
|
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 |
close()
Close the cursor and releases the associated resources.
|
Position |
findNewestMatching(ManagedCursor.FindPositionConstraint constraint,
com.google.common.base.Predicate<Entry> condition)
Find the newest entry that matches the given predicate.
|
long |
getNumberOfEntries()
Return the number of messages that this cursor still has to read.
|
long |
getNumberOfEntries(com.google.common.collect.Range<PositionImpl> range)
Return the number of messages that this cursor still has to read.
|
Position |
getReadPosition()
Get the read position.
|
boolean |
hasMoreEntries()
Tells whether this cursor has already consumed all the available entries.
|
List<Entry> |
readEntries(int numberOfEntriesToRead)
Read entries from the ManagedLedger, up to the specified number.
|
void |
skipEntries(int numEntriesToSkip)
Skip n entries from the read position of this cursor.
|
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 readPosition getReadPosition()
boolean hasMoreEntries()
This method is not blocking.
long getNumberOfEntries()
This method has linear time complexity on the number of ledgers included in the managed ledger.
void skipEntries(int numEntriesToSkip)
numEntriesToSkip - number of entries to skipPosition 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 conditionInterruptedExceptionManagedLedgerExceptionlong getNumberOfEntries(com.google.common.collect.Range<PositionImpl> range)
range - the range between two positionsvoid close()
throws InterruptedException,
ManagedLedgerException
void asyncClose(AsyncCallbacks.CloseCallback callback, Object ctx)
callback - callback objectctx - opaque contextCopyright © 2017–2021 Apache Software Foundation. All rights reserved.