Hazelcast C++ Client
Public Member Functions | Static Public Attributes | List of all members
hazelcast::client::ringbuffer::ReadResultSet< E > Class Template Reference

Public Member Functions

 ReadResultSet (int32_t readCount, const std::vector< serialization::pimpl::Data > &dataItems, serialization::pimpl::SerializationService &serializationService, std::auto_ptr< std::vector< int64_t > > &itemSeqs, bool itemSeqsExist, int64_t nextSeq)
 
virtual int32_t readCount () const
 Returns the number of items that have been read before filtering. More...
 
virtual DataArray< E > & getItems ()
 
virtual int64_t getSequence (int32_t index) const
 Return the sequence number for the item at the given index. More...
 
virtual int64_t getNextSequenceToReadFrom () const
 Returns the sequence of the item following the last read item. More...
 

Static Public Attributes

static const int64_t SEQUENCE_UNAVAILABLE = -1
 Value returned from methods returning a sequence number when the information is not available (e.g. More...
 

Member Function Documentation

◆ getNextSequenceToReadFrom()

template<typename E >
virtual int64_t hazelcast::client::ringbuffer::ReadResultSet< E >::getNextSequenceToReadFrom ( ) const
inlinevirtual

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 readCount(). 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} means that the information is not available.

Returns
the sequence of the item following the last item in the result set
Since
3.10

◆ getSequence()

template<typename E >
virtual int64_t hazelcast::client::ringbuffer::ReadResultSet< E >::getSequence ( int32_t  index) const
inlinevirtual

Return the sequence number for the item at the given index.

Parameters
indexthe index
Returns
the sequence number for the ringbuffer item
Exceptions
IllegalArgumentExceptionif index out of bounds.
Since
3.9

◆ readCount()

template<typename E >
virtual int32_t hazelcast::client::ringbuffer::ReadResultSet< E >::readCount ( ) const
inlinevirtual

Returns the number of items that have been read before filtering.

If no filter is set, then the

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

and not by size(). Otherwise you will be re-reading the same filtered messages.

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

Member Data Documentation

◆ SEQUENCE_UNAVAILABLE

template<typename E >
const int64_t hazelcast::client::ringbuffer::ReadResultSet< E >::SEQUENCE_UNAVAILABLE = -1
static

Value returned from methods returning a sequence number when the information is not available (e.g.

because of rolling upgrade and some members not returning the sequence).


The documentation for this class was generated from the following file: