Hazelcast C++ Client
Hazelcast C++ Client Library
hazelcast::client::hazelcast_client Class Reference

Public Member Functions

const std::string & get_name () const
 Returns the name of this client instance. More...
 
template<typename T >
boost::shared_future< std::shared_ptr< T > > get_distributed_object (const std::string &name)
 
boost::shared_future< std::shared_ptr< imap > > get_map (const std::string &name)
 Returns the distributed map instance with the specified name. More...
 
boost::shared_future< std::shared_ptr< multi_map > > get_multi_map (const std::string &name)
 Returns the distributed multimap instance with the specified name. More...
 
boost::shared_future< std::shared_ptr< replicated_map > > get_replicated_map (const std::string &name)
 
boost::shared_future< std::shared_ptr< iqueue > > get_queue (const std::string &name)
 Returns the distributed queue instance with the specified name. More...
 
boost::shared_future< std::shared_ptr< iset > > get_set (const std::string &name)
 Returns the distributed set instance with the specified name. More...
 
boost::shared_future< std::shared_ptr< ilist > > get_list (const std::string &name)
 Returns the distributed list instance with the specified name. More...
 
boost::shared_future< std::shared_ptr< itopic > > get_topic (const std::string &name)
 Returns the distributed topic instance with the specified name. More...
 
boost::shared_future< std::shared_ptr< reliable_topic > > get_reliable_topic (const std::string &name)
 Returns the distributed topic instance with the specified name. More...
 
boost::shared_future< std::shared_ptr< flake_id_generator > > get_flake_id_generator (const std::string &name)
 Returns a generator that creates a cluster-wide unique IDs. More...
 
boost::shared_future< std::shared_ptr< pn_counter > > get_pn_counter (const std::string &name)
 Obtain a pn_counter with the given name. More...
 
boost::shared_future< std::shared_ptr< ringbuffer > > get_ringbuffer (const std::string &name)
 Returns the distributed ringbuffer instance with the specified name. More...
 
boost::shared_future< std::shared_ptr< iexecutor_service > > get_executor_service (const std::string &name)
 Creates or returns the distributed executor service for the given name. More...
 
client_configget_client_config ()
 
transaction_context new_transaction_context ()
 Creates a new transaction_context associated with the current thread using default options. More...
 
transaction_context new_transaction_context (const transaction_options &options)
 Creates a new transaction_context associated with the current thread with given options. More...
 
clusterget_cluster ()
 Returns the Cluster that connected Hazelcast instance is a part of. More...
 
local_endpoint get_local_endpoint () const
 Returns the local endpoint which this HazelcastInstance belongs to. More...
 
boost::uuids::uuid add_lifecycle_listener (lifecycle_listener &&lifecycle_listener)
 Add listener to listen lifecycle events. More...
 
bool remove_lifecycle_listener (const boost::uuids::uuid &registration_id)
 Remove lifecycle listener. More...
 
boost::future< void > shutdown ()
 Shuts down this hazelcast_client.
 
spi::lifecycle_service & get_lifecycle_service ()
 Returns the lifecycle service for this instance. More...
 
cp::cp_subsystemget_cp_subsystem ()
 
sql::sql_serviceget_sql ()
 

Friends

class spi::ClientContext
 
boost::future< hazelcast_clienthazelcast::new_client ()
 
boost::future< hazelcast_clienthazelcast::new_client (hazelcast::client::client_config config)
 

Detailed Description

Definition at line 71 of file hazelcast_client.h.

Member Function Documentation

◆ add_lifecycle_listener()

boost::uuids::uuid hazelcast::client::hazelcast_client::add_lifecycle_listener ( lifecycle_listener &&  lifecycle_listener)

Add listener to listen lifecycle 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
lifecycleListenerListener object

Definition at line 104 of file client_impl.cpp.

106 {
107  return client_impl_->add_lifecycle_listener(std::move(lifecycle_listener));
108 }

◆ get_client_config()

client_config & hazelcast::client::hazelcast_client::get_client_config ( )
Returns
configuration of this Hazelcast client.

Definition at line 80 of file client_impl.cpp.

81 {
82  return client_impl_->get_client_config();
83 }

◆ get_cluster()

cluster & hazelcast::client::hazelcast_client::get_cluster ( )

Returns the Cluster that connected Hazelcast instance is a part of.

Cluster interface allows you to add listener for membership events and learn more about the cluster.

Returns
cluster

Definition at line 98 of file client_impl.cpp.

99 {
100  return client_impl_->get_cluster();
101 }

◆ get_cp_subsystem()

cp::cp_subsystem & hazelcast::client::hazelcast_client::get_cp_subsystem ( )
Returns
the CP subsystem that offers a set of in-memory linearizable data structures

Definition at line 138 of file client_impl.cpp.

139 {
140  return client_impl_->get_cp_subsystem();
141 }

◆ get_distributed_object()

template<typename T >
boost::shared_future<std::shared_ptr<T> > hazelcast::client::hazelcast_client::get_distributed_object ( const std::string &  name)
inline
Template Parameters
Ttype of the distributed object
Parameters
namename of the distributed object.
Returns
distributed object

Definition at line 97 of file hazelcast_client.h.

99  {
100  return client_impl_->get_distributed_object<T>(name);
101  }

◆ get_executor_service()

boost::shared_future<std::shared_ptr<iexecutor_service> > hazelcast::client::hazelcast_client::get_executor_service ( const std::string &  name)
inline

Creates or returns the distributed executor service for the given name.

Executor service enables you to run your Runnables and Callables on the Hazelcast cluster.

Note: Note that it doesn't support

invokeAll/Any

and doesn't have standard shutdown behavior

Parameters
namename of the executor service
Returns
the distributed executor service for the given name

Definition at line 259 of file hazelcast_client.h.

260  {
261  return client_impl_->get_distributed_object<iexecutor_service>(name);
262  }

◆ get_flake_id_generator()

boost::shared_future<std::shared_ptr<flake_id_generator> > hazelcast::client::hazelcast_client::get_flake_id_generator ( const std::string &  name)
inline

Returns a generator that creates a cluster-wide unique IDs.

Generated IDs are

long

primitive values and are k-ordered (roughly ordered). IDs are in the range from

0

to

Long.MAX_VALUE

.

The IDs contain timestamp component and a node ID component, which is assigned when the member joins the cluster. This allows the IDs to be ordered and unique without any coordination between members, which makes the generator safe even in split-brain scenario (for caveats, {see here}). For more details and caveats, see class documentation for flake_id_generator.

Parameters
namename of the flake_id_generator
Returns
flake_id_generator for the given name

Definition at line 213 of file hazelcast_client.h.

214  {
215  return client_impl_->get_distributed_object<flake_id_generator>(name);
216  }

◆ get_lifecycle_service()

spi::lifecycle_service & hazelcast::client::hazelcast_client::get_lifecycle_service ( )

Returns the lifecycle service for this instance.

LifecycleService allows you to shutdown this HazelcastInstance and listen for the lifecycle events.

Returns
the lifecycle service for this instance

Definition at line 124 of file client_impl.cpp.

125 {
126  return client_impl_->get_lifecycle_service();
127 }

◆ get_list()

boost::shared_future<std::shared_ptr<ilist> > hazelcast::client::hazelcast_client::get_list ( const std::string &  name)
inline

Returns the distributed list instance with the specified name.

List is ordered set of entries. similar to std::vector

Parameters
namename of the distributed list
Returns
distributed list instance with the specified name

Definition at line 166 of file hazelcast_client.h.

168  {
169  return client_impl_->get_distributed_object<ilist>(name);
170  }

◆ get_local_endpoint()

local_endpoint hazelcast::client::hazelcast_client::get_local_endpoint ( ) const

Returns the local endpoint which this HazelcastInstance belongs to.

Returns
the local enpoint which this client belongs to
See also
Client

Definition at line 130 of file client_impl.cpp.

131 {
132  return client_impl_->get_local_endpoint();
133 }

◆ get_map()

boost::shared_future<std::shared_ptr<imap> > hazelcast::client::hazelcast_client::get_map ( const std::string &  name)
inline

Returns the distributed map instance with the specified name.

Template Parameters
Kkey type
Vvalue type
Parameters
namename of the distributed map
Returns
distributed map instance with the specified name

Definition at line 112 of file hazelcast_client.h.

113  {
114  return client_impl_->get_distributed_object<imap>(name);
115  }

◆ get_multi_map()

boost::shared_future<std::shared_ptr<multi_map> > hazelcast::client::hazelcast_client::get_multi_map ( const std::string &  name)
inline

Returns the distributed multimap instance with the specified name.

Parameters
namename of the distributed multimap
Returns
distributed multimap instance with the specified name

Definition at line 123 of file hazelcast_client.h.

125  {
126  return client_impl_->get_distributed_object<multi_map>(name);
127  }

◆ get_name()

const std::string & hazelcast::client::hazelcast_client::get_name ( ) const

Returns the name of this client instance.

Returns
name of this client instance

Definition at line 74 of file client_impl.cpp.

75 {
76  return client_impl_->get_name();
77 }

◆ get_pn_counter()

boost::shared_future<std::shared_ptr<pn_counter> > hazelcast::client::hazelcast_client::get_pn_counter ( const std::string &  name)
inline

Obtain a pn_counter with the given name.

The PN counter can be used as a counter with strong eventual consistency guarantees - if operations to the counters stop, the counter values of all replicas that can communicate with each other should eventually converge to the same value.

Parameters
namethe name of the PN counter
Returns
a pn_counter

Definition at line 230 of file hazelcast_client.h.

232  {
233  return client_impl_->get_distributed_object<pn_counter>(name);
234  }

◆ get_queue()

boost::shared_future<std::shared_ptr<iqueue> > hazelcast::client::hazelcast_client::get_queue ( const std::string &  name)
inline

Returns the distributed queue instance with the specified name.

Parameters
namename of the distributed queue
Returns
distributed queue instance with the specified name

Definition at line 141 of file hazelcast_client.h.

143  {
144  return client_impl_->get_distributed_object<iqueue>(name);
145  }

◆ get_reliable_topic()

boost::shared_future<std::shared_ptr<reliable_topic> > hazelcast::client::hazelcast_client::get_reliable_topic ( const std::string &  name)
inline

Returns the distributed topic instance with the specified name.

Parameters
namename of the distributed topic
Returns
distributed topic instance with the specified name

Definition at line 190 of file hazelcast_client.h.

192  {
193  return client_impl_->get_distributed_object<reliable_topic>(name);
194  }

◆ get_ringbuffer()

boost::shared_future<std::shared_ptr<ringbuffer> > hazelcast::client::hazelcast_client::get_ringbuffer ( const std::string &  name)
inline

Returns the distributed ringbuffer instance with the specified name.

Parameters
namename of the distributed ringbuffer
Returns
distributed ringbuffer instance with the specified name

Definition at line 242 of file hazelcast_client.h.

244  {
245  return client_impl_->get_distributed_object<ringbuffer>(name);
246  }

◆ get_set()

boost::shared_future<std::shared_ptr<iset> > hazelcast::client::hazelcast_client::get_set ( const std::string &  name)
inline

Returns the distributed set instance with the specified name.

Set is ordered unique set of entries. similar to std::unordered_set

Parameters
namename of the distributed set
Returns
distributed set instance with the specified name

Definition at line 154 of file hazelcast_client.h.

155  {
156  return client_impl_->get_distributed_object<iset>(name);
157  }

◆ get_sql()

sql::sql_service & hazelcast::client::hazelcast_client::get_sql ( )
Returns
a service to execute distributed SQL queries.

Definition at line 144 of file client_impl.cpp.

145 {
146  return client_impl_->get_sql();
147 }

◆ get_topic()

boost::shared_future<std::shared_ptr<itopic> > hazelcast::client::hazelcast_client::get_topic ( const std::string &  name)
inline

Returns the distributed topic instance with the specified name.

Parameters
namename of the distributed topic
Returns
distributed topic instance with the specified name

Definition at line 178 of file hazelcast_client.h.

180  {
181  return client_impl_->get_distributed_object<itopic>(name);
182  };

◆ new_transaction_context() [1/2]

transaction_context hazelcast::client::hazelcast_client::new_transaction_context ( )

Creates a new transaction_context associated with the current thread using default options.

Returns
new transaction_context

Definition at line 86 of file client_impl.cpp.

87 {
88  return client_impl_->new_transaction_context();
89 }

◆ new_transaction_context() [2/2]

transaction_context hazelcast::client::hazelcast_client::new_transaction_context ( const transaction_options options)

Creates a new transaction_context associated with the current thread with given options.

Parameters
optionsoptions for this transaction
Returns
new transaction_context

Definition at line 92 of file client_impl.cpp.

93 {
94  return client_impl_->new_transaction_context(options);
95 }

◆ remove_lifecycle_listener()

bool hazelcast::client::hazelcast_client::remove_lifecycle_listener ( const boost::uuids::uuid &  registration_id)

Remove lifecycle listener.

Parameters
lifecycleListener
Returns
true if removed successfully

Definition at line 111 of file client_impl.cpp.

113 {
114  return client_impl_->remove_lifecycle_listener(registration_id);
115 }

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