GridGain C++
cluster_node.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019 GridGain Systems, Inc. and Contributors.
3  *
4  * Licensed under the GridGain Community Edition License (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  * https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license
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 
22 #ifndef _IGNITE_CLUSTER_CLUSTER_NODE
23 #define _IGNITE_CLUSTER_CLUSTER_NODE
24 
25 #include <ignite/impl/cluster/cluster_node_impl.h>
26 
27 namespace ignite
28 {
29  namespace cluster
30  {
35  class IGNITE_IMPORT_EXPORT ClusterNode
36  {
37  public:
43  ClusterNode(common::concurrent::SharedPointer<ignite::impl::cluster::ClusterNodeImpl> impl);
44 
50  const std::vector<std::string>& GetAddresses() const;
51 
58  bool IsAttributeSet(std::string name) const;
59 
69  template<typename T>
70  T GetAttribute(std::string name) const
71  {
72  return impl.Get()->GetAttribute<T>(name);
73  }
74 
80  std::vector<std::string> GetAttributes() const;
81 
87  std::string GetConsistentId() const;
88 
94  const std::vector<std::string>& GetHostNames() const;
95 
101  Guid GetId() const;
102 
108  bool IsClient() const;
109 
115  bool IsDaemon() const;
116 
122  bool IsLocal() const;
123 
129  int64_t GetOrder() const;
130 
136  const IgniteProductVersion& GetVersion() const;
137 
145  friend IGNITE_IMPORT_EXPORT bool operator<(const ClusterNode& lnode, const ClusterNode& rnode)
146  {
147  return lnode.GetId() < rnode.GetId();
148  }
149 
150  private:
151  common::concurrent::SharedPointer<ignite::impl::cluster::ClusterNodeImpl> impl;
152  };
153  }
154 }
155 
156 #endif //_IGNITE_CLUSTER_CLUSTER_NODE
ignite
Ignite API.
Definition: cache.h:47
ignite::IgniteProductVersion
Ignite product version.
Definition: ignite_product_version.h:35
ignite::Guid
Global universally unique identifier (GUID).
Definition: guid.h:35
ignite::cluster::ClusterNode::GetId
Guid GetId() const
Get globally unique node ID.
Definition: cluster_node.cpp:57
ignite::cluster::ClusterNode::GetAttribute
T GetAttribute(std::string name) const
Get a node attribute.
Definition: cluster_node.h:70
ignite::cluster::ClusterNode::operator<
friend IGNITE_IMPORT_EXPORT bool operator<(const ClusterNode &lnode, const ClusterNode &rnode)
Define "less" operator to allow Cluster Node usage as STL container key.
Definition: cluster_node.h:145
ignite::cluster::ClusterNode
Interface representing a single cluster node.
Definition: cluster_node.h:35