Hazelcast C++ Client
Hazelcast C++ Client Library
Loading...
Searching...
No Matches
hazelcast::client::member Class Reference

hz_cluster member class. More...

#include <member.h>

Classes

struct  version

Public Types

enum  member_attribute_operation_type { PUT = 1 , REMOVE = 2 }
 PUT even type representing an addition of an attribute REMOVE event type representing a deletion of an attribute. More...

Public Member Functions

 member (address member_address, boost::uuids::uuid uuid, bool lite, std::unordered_map< std::string, std::string > attr, std::unordered_map< endpoint_qualifier, address > address_map, version v={ 0, 0, 0 })
 member (address member_address)
 member (boost::uuids::uuid uuid)
bool is_lite_member () const
 Lite member is does not hold data.
const addressget_address () const
 Returns the socket address of this member.
boost::uuids::uuid get_uuid () const
 Returns UUID of this member.
const std::unordered_map< std::string, std::string > & get_attributes () const
const std::string * get_attribute (const std::string &key) const
 Returns the value of the specified key for this member or default constructed value if value is undefined.
version get_version () const
 Returns the Hazelcast codebase version of this member; this may or may not be different from the version reported by cluster version, for example when a node with a different codebase version is added to an existing cluster.
bool lookup_attribute (const std::string &key) const
 check if an attribute is defined for given key.
const std::unordered_map< endpoint_qualifier, address > & address_map () const
bool operator< (const member &rhs) const

Friends

bool HAZELCAST_API operator== (const member &lhs, const member &rhs)

Detailed Description

hz_cluster member class.

The default implementation

See also
Cluster
MembershipListener

Definition at line 61 of file member.h.

Member Enumeration Documentation

◆ member_attribute_operation_type

PUT even type representing an addition of an attribute REMOVE event type representing a deletion of an attribute.

Definition at line 68 of file member.h.

69 {
70 PUT = 1,
71 REMOVE = 2
72 };

Constructor & Destructor Documentation

◆ member() [1/4]

hazelcast::client::member::member ( )

Definition at line 56 of file cluster.cpp.

57 : lite_member_(false)
58 , version_{ 0, 0, 0 }
59{}

◆ member() [2/4]

hazelcast::client::member::member ( address member_address,
boost::uuids::uuid uuid,
bool lite,
std::unordered_map< std::string, std::string > attr,
std::unordered_map< endpoint_qualifier, address > address_map,
version v = { 0, 0, 0 } )

Definition at line 61 of file cluster.cpp.

67 : address_(std::move(member_address))
68 , uuid_(uuid)
69 , lite_member_(lite)
70 , attributes_(std::move(attr))
71 , address_map_(std::move(address_map))
72 , version_(v)
73{}

◆ member() [3/4]

hazelcast::client::member::member ( address member_address)

Definition at line 75 of file cluster.cpp.

76 : address_(member_address)
77 , lite_member_(false)
78 , version_{ 0, 0, 0 }
79{}

◆ member() [4/4]

hazelcast::client::member::member ( boost::uuids::uuid uuid)

Definition at line 81 of file cluster.cpp.

82 : uuid_(uuid)
83 , lite_member_(false)
84 , version_{ 0, 0, 0 }
85{}

Member Function Documentation

◆ address_map()

const std::unordered_map< endpoint_qualifier, address > & hazelcast::client::member::address_map ( ) const

Definition at line 158 of file cluster.cpp.

159{
160 return address_map_;
161}

◆ get_address()

const address & hazelcast::client::member::get_address ( ) const

Returns the socket address of this member.

Returns
socket address of this member

Definition at line 88 of file cluster.cpp.

89{
90 return address_;
91}

◆ get_attribute()

const std::string * hazelcast::client::member::get_attribute ( const std::string & key) const

Returns the value of the specified key for this member or default constructed value if value is undefined.

Template Parameters
AttributeTypetype template for attribute type
Parameters
keyThe key to lookup.
Returns
The value for this members key.

Definition at line 128 of file cluster.cpp.

129{
130 std::unordered_map<std::string, std::string>::const_iterator it =
131 attributes_.find(key);
132 if (attributes_.end() != it) {
133 return &(it->second);
134 } else {
135 return NULL;
136 }
137}

◆ get_attributes()

const std::unordered_map< std::string, std::string > & hazelcast::client::member::get_attributes ( ) const

Definition at line 106 of file cluster.cpp.

107{
108 return attributes_;
109}

◆ get_uuid()

boost::uuids::uuid hazelcast::client::member::get_uuid ( ) const

Returns UUID of this member.

Returns
UUID of this member.

Definition at line 94 of file cluster.cpp.

95{
96 return uuid_;
97}

◆ get_version()

member::version hazelcast::client::member::get_version ( ) const

Returns the Hazelcast codebase version of this member; this may or may not be different from the version reported by cluster version, for example when a node with a different codebase version is added to an existing cluster.

Returns
the version of this member.
Since
5.1

Definition at line 140 of file cluster.cpp.

141{
142 return version_;
143}

◆ is_lite_member()

bool hazelcast::client::member::is_lite_member ( ) const

Lite member is does not hold data.

Returns
true if member is lite.

Definition at line 100 of file cluster.cpp.

101{
102 return lite_member_;
103}

◆ lookup_attribute()

bool hazelcast::client::member::lookup_attribute ( const std::string & key) const

check if an attribute is defined for given key.

Template Parameters
keyfor the attribute
Returns
true if attribute is defined.

Definition at line 146 of file cluster.cpp.

147{
148 return attributes_.find(key) != attributes_.end();
149}

◆ operator<()

bool hazelcast::client::member::operator< ( const member & rhs) const

Definition at line 151 of file cluster.cpp.

153{
154 return uuid_ < rhs.uuid_;
155}

◆ operator==

bool HAZELCAST_API operator== ( const member & lhs,
const member & rhs )
friend

Definition at line 164 of file cluster.cpp.

165{
166 return lhs.address_ == rhs.address_ && lhs.uuid_ == rhs.uuid_;
167}

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