Hazelcast C++ Client
Hazelcast C++ Client Library
member.h
1 /*
2  * Copyright (c) 2008-2021, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 
18 #include <unordered_map>
19 #include <functional>
20 #include <memory>
21 
22 #include "hazelcast/client/address.h"
23 #include <boost/uuid/uuid.hpp>
24 
25 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
26 #pragma warning(push)
27 #pragma warning(disable: 4251) //for dll export
28 #endif
29 
30 namespace hazelcast {
31  namespace client {
32 
39  class HAZELCAST_API member {
40  public:
46  PUT = 1,
47  REMOVE = 2
48  };
49 
50  member();
51 
52  member(address address, boost::uuids::uuid uuid, bool lite, std::unordered_map<std::string, std::string> attr);
53 
54  member(address member_address);
55 
56  member(boost::uuids::uuid uuid);
57 
61  bool operator==(const member &) const;
62 
68  bool is_lite_member() const;
69 
75  const address &get_address() const;
76 
82  boost::uuids::uuid get_uuid() const;
83 
84  const std::unordered_map<std::string, std::string> &get_attributes() const;
85 
94  const std::string *get_attribute(const std::string &key) const;
95 
102  bool lookup_attribute(const std::string &key) const;
103 
104  bool operator<(const member &rhs) const;
105 
106  private:
107  address address_;
108  boost::uuids::uuid uuid_;
109  bool lite_member_;
110  std::unordered_map<std::string, std::string> attributes_;
111  };
112 
113  std::ostream HAZELCAST_API &operator<<(std::ostream &out, const member &member);
114  }
115 }
116 
117 namespace std {
118  template<>
119  struct HAZELCAST_API hash<hazelcast::client::member> {
120  std::size_t operator()(const hazelcast::client::member &k) const noexcept;
121  };
122 }
123 
124 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
125 #pragma warning(pop)
126 #endif
127 
128 
129 
130 
Represents an address of a client or member in the cluster.
Definition: address.h:36
hz_cluster member class.
Definition: member.h:39
member_attribute_operation_type
PUT even type representing an addition of an attribute REMOVE event type representing a deletion of a...
Definition: member.h:45