Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ReadResultSet<T>

Defines the result of a Ringbuffer.readMany operation.

Type parameters

  • T

Hierarchy

  • ReadResultSet

Index

Methods

get

  • get(index: number): T
  • Gets the item at the given index.

    Parameters

    • index: number

    Returns T

    the found item or undefined if the index is out of bounds

getNextSequenceToReadFrom

  • getNextSequenceToReadFrom(): Long
  • Returns the sequence of the item following the last read item. This sequence can then be used to read items following the ones returned by this result set.

    Usually this sequence is equal to the sequence used to retrieve this result set incremented by the {@link getReadCount()}. In cases when the reader tolerates lost items, this is not the case.

    For instance, if the reader requests an item with a stale sequence (one which has already been overwritten), the read will jump to the oldest sequence and read from there.

    Similarly, if the reader requests an item in the future (e.g. because the partition was lost and the reader was unaware of this), the read method will jump back to the newest available sequence. Because of these jumps and only in the case when the reader is loss tolerant, the next sequence must be retrieved using this method. A return value of SEQUENCE_UNAVAILABLE (-1) means that the information is not available.

    Returns Long

    the sequence of the item following the last item in the result set

getReadCount

  • getReadCount(): number
  • Returns the number of items that have been read before filtering.

    If no filter is set, then the readCount will be equal to size. But if a filter is applied, it could be that items are read, but are filtered out. So if you are trying to make another read based on the ReadResultSet then you should increment the sequence by readCount and not by size. Otherwise you will be re-reading the same filtered messages.

    Returns number

    the number of items read (including the filtered ones).

getSequence

  • getSequence(index: number): Long
  • Returns the sequence number for the item at the given index.

    Parameters

    • index: number

    Returns Long

    the sequence number for the ringbuffer item or undefined if the index is out of bounds.

size

  • size(): number
  • Returns the result set size.

    Returns number

    the result set size

Generated using TypeDoc