Hazelcast C++ Client
Public Member Functions | Static Public Attributes | Friends | List of all members
hazelcast::client::iqueue Class Reference

Concurrent, blocking, distributed, observable, client queue. More...

#include <iqueue.h>

+ Inheritance diagram for hazelcast::client::iqueue:

Public Member Functions

boost::future< boost::uuids::uuid > add_item_listener (item_listener &&listener, bool include_value)
 Adds an item listener for this collection. More...
 
template<typename E >
boost::future< bool > offer (const E &element)
 Inserts the specified element into this queue. More...
 
template<typename E >
boost::future< void > put (const E &element)
 Puts the element into queue. More...
 
template<typename E >
boost::future< bool > offer (const E &element, std::chrono::milliseconds timeout)
 Inserts the specified element into this queue. More...
 
template<typename E >
boost::future< boost::optional< E > > take ()
 
template<typename E >
boost::future< boost::optional< E > > poll (std::chrono::milliseconds timeout)
 
template<typename E >
boost::future< bool > remove (const E &element)
 
template<typename E >
boost::future< bool > contains (const E &element)
 
template<typename E >
boost::future< size_t > drain_to (std::vector< E > &elements)
 Note that elements will be pushed_back to vector. More...
 
template<typename E >
boost::future< size_t > drain_to (std::vector< E > &elements, size_t max_elements)
 Note that elements will be pushed_back to vector. More...
 
template<typename E >
boost::future< boost::optional< E > > poll ()
 Returns immediately without waiting. More...
 
template<typename E >
boost::future< boost::optional< E > > peek ()
 Returns immediately without waiting. More...
 
template<typename E >
boost::future< std::vector< E > > to_array ()
 
template<typename E >
boost::future< bool > contains_all (const std::vector< E > &elements)
 
template<typename E >
boost::future< bool > add_all (const std::vector< E > &elements)
 
template<typename E >
boost::future< bool > remove_all (const std::vector< E > &elements)
 
template<typename E >
boost::future< bool > retain_all (const std::vector< E > &elements)
 Removes the elements from this queue that are not available in given "elements" vector. More...
 

Static Public Attributes

static constexpr const char * SERVICE_NAME = "hz:impl:queueService"
 

Friends

class spi::ProxyManager
 

Detailed Description

Concurrent, blocking, distributed, observable, client queue.

Member Function Documentation

◆ add_all()

template<typename E >
boost::future<bool> hazelcast::client::iqueue::add_all ( const std::vector< E > &  elements)
inline
Parameters
elementsstd::vector<E>
Returns
true if all elements given in vector can be added to queue.

◆ add_item_listener()

boost::future<boost::uuids::uuid> hazelcast::client::iqueue::add_item_listener ( item_listener &&  listener,
bool  include_value 
)
inline

Adds an item listener for this collection.

Listener will get notified for all collection add/remove events.

Warning 1: If listener should do a time consuming operation, off-load the operation to another thread. otherwise it will slow down the system.

Warning 2: Do not make a call to hazelcast. It can cause deadlock.

Parameters
listeneritem listener
includeValuetrue updated item should be passed to the item listener, false otherwise.
Returns
returns registration id.

◆ contains()

template<typename E >
boost::future<bool> hazelcast::client::iqueue::contains ( const E &  element)
inline
Parameters
elementto be checked.
Returns
true if queue contains the element.

◆ contains_all()

template<typename E >
boost::future<bool> hazelcast::client::iqueue::contains_all ( const std::vector< E > &  elements)
inline
Parameters
elementsstd::vector<E>
Returns
true if this queue contains all elements given in vector.

◆ drain_to() [1/2]

template<typename E >
boost::future<size_t> hazelcast::client::iqueue::drain_to ( std::vector< E > &  elements)
inline

Note that elements will be pushed_back to vector.

Parameters
elementsthe vector that elements will be drained to.
Returns
number of elements drained.

◆ drain_to() [2/2]

template<typename E >
boost::future<size_t> hazelcast::client::iqueue::drain_to ( std::vector< E > &  elements,
size_t  max_elements 
)
inline

Note that elements will be pushed_back to vector.

Parameters
maxElementsupper limit to be filled to vector.
elementsvector that elements will be drained to.
Returns
number of elements drained.

◆ offer() [1/2]

template<typename E >
boost::future<bool> hazelcast::client::iqueue::offer ( const E &  element)
inline

Inserts the specified element into this queue.

Parameters
elementto add
Returns
true if the element was added to this queue, else false

◆ offer() [2/2]

template<typename E >
boost::future<bool> hazelcast::client::iqueue::offer ( const E &  element,
std::chrono::milliseconds  timeout 
)
inline

Inserts the specified element into this queue.

If queue is full waits for space to became available for specified time.

Parameters
elementto add
timeouthow long to wait before giving up
Returns
true if successful, or false if the specified waiting time elapses before space is available

◆ peek()

template<typename E >
boost::future<boost::optional<E> > hazelcast::client::iqueue::peek ( )
inline

Returns immediately without waiting.

Returns
head of queue without removing it. If not available returns empty constructed shared_ptr.

◆ poll() [1/2]

template<typename E >
boost::future<boost::optional<E> > hazelcast::client::iqueue::poll ( std::chrono::milliseconds  timeout)
inline
Parameters
timeouttime to wait if item is not available.
Returns
the head of the queue. If queue is empty waits for specified time.

◆ poll() [2/2]

template<typename E >
boost::future<boost::optional<E> > hazelcast::client::iqueue::poll ( )
inline

Returns immediately without waiting.

Returns
removes head of the queue and returns it to user . If not available returns empty constructed shared_ptr.

◆ put()

template<typename E >
boost::future<void> hazelcast::client::iqueue::put ( const E &  element)
inline

Puts the element into queue.

If queue is full waits for space to became available.

◆ remove()

template<typename E >
boost::future<bool> hazelcast::client::iqueue::remove ( const E &  element)
inline
Parameters
elementto be removed.
Returns
true if element removed successfully.

◆ remove_all()

template<typename E >
boost::future<bool> hazelcast::client::iqueue::remove_all ( const std::vector< E > &  elements)
inline
Parameters
elementsstd::vector<E>
Returns
true if all elements are removed successfully.

◆ retain_all()

template<typename E >
boost::future<bool> hazelcast::client::iqueue::retain_all ( const std::vector< E > &  elements)
inline

Removes the elements from this queue that are not available in given "elements" vector.

Parameters
elementsstd::vector<E>
Returns
true if operation is successful.

◆ take()

template<typename E >
boost::future<boost::optional<E> > hazelcast::client::iqueue::take ( )
inline
Returns
the head of the queue. If queue is empty waits for an item to be added.

◆ to_array()

template<typename E >
boost::future<std::vector<E> > hazelcast::client::iqueue::to_array ( )
inline
Returns
all elements as std::vector

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