接口 ReadOnlyCursor

所有已知实现类:
ReadOnlyCursorImpl

@LimitedPrivate @Stable public interface ReadOnlyCursor
  • 方法详细资料

    • readEntries

      List<Entry> readEntries(int numberOfEntriesToRead) throws InterruptedException, ManagedLedgerException
      Read entries from the ManagedLedger, up to the specified number. The returned list can be smaller.
      参数:
      numberOfEntriesToRead - maximum number of entries to return
      返回:
      the list of entries
      抛出:
      ManagedLedgerException
      InterruptedException
    • asyncReadEntries

      void asyncReadEntries(int numberOfEntriesToRead, AsyncCallbacks.ReadEntriesCallback callback, Object ctx, PositionImpl maxPosition)
      Asynchronously read entries from the ManagedLedger.
      参数:
      numberOfEntriesToRead - maximum number of entries to return
      callback - callback object
      ctx - opaque context
      maxPosition - max position can read
      另请参阅:
    • asyncReadEntries

      void asyncReadEntries(int numberOfEntriesToRead, long maxSizeBytes, AsyncCallbacks.ReadEntriesCallback callback, Object ctx, PositionImpl maxPosition)
      Asynchronously read entries from the ManagedLedger.
      参数:
      numberOfEntriesToRead - maximum number of entries to return
      maxSizeBytes - max size in bytes of the entries to return
      callback - callback object
      ctx - opaque context
      maxPosition - max position can read
    • getReadPosition

      Position getReadPosition()
      Get the read position. This points to the next message to be read from the cursor.
      返回:
      the read position
    • hasMoreEntries

      boolean hasMoreEntries()
      Tells whether this cursor has already consumed all the available entries.

      This method is not blocking.

      返回:
      true if there are pending entries to read, false otherwise
    • getNumberOfEntries

      long getNumberOfEntries()
      Return the number of messages that this cursor still has to read.

      This method has linear time complexity on the number of ledgers included in the managed ledger.

      返回:
      the number of entries
    • skipEntries

      void skipEntries(int numEntriesToSkip)
      Skip n entries from the read position of this cursor.
      参数:
      numEntriesToSkip - number of entries to skip
    • findNewestMatching

      Position findNewestMatching(ManagedCursor.FindPositionConstraint constraint, com.google.common.base.Predicate<Entry> condition) throws InterruptedException, ManagedLedgerException
      Find the newest entry that matches the given predicate.
      参数:
      constraint - search only active entries or all entries
      condition - predicate that reads an entry an applies a condition
      返回:
      Position of the newest entry that matches the given predicate
      抛出:
      InterruptedException
      ManagedLedgerException
    • getNumberOfEntries

      long getNumberOfEntries(com.google.common.collect.Range<PositionImpl> range)
      Return the number of messages that this cursor still has to read.

      This method has linear time complexity on the number of ledgers included in the managed ledger.

      参数:
      range - the range between two positions
      返回:
      the number of entries in range
    • close

      Close the cursor and releases the associated resources.
      抛出:
      InterruptedException
      ManagedLedgerException
    • asyncClose

      void asyncClose(AsyncCallbacks.CloseCallback callback, Object ctx)
      Close the cursor asynchronously and release the associated resources.
      参数:
      callback - callback object
      ctx - opaque context