| Apache Ignite C++

cluster_node.h
Go to the documentation of this file.
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
23 #ifndef _IGNITE_CLUSTER_CLUSTER_NODE
24 #define _IGNITE_CLUSTER_CLUSTER_NODE
25
26 #include <ignite/impl/cluster/cluster_node_impl.h>
27
28 namespace ignite
29 {
30 namespace cluster
31 {
36 class IGNITE_IMPORT_EXPORT ClusterNode
37 {
38 public:
44 ClusterNode(common::concurrent::SharedPointer<ignite::impl::cluster::ClusterNodeImpl> impl);
45
51 const std::vector<std::string>& GetAddresses() const;
52
59 bool IsAttributeSet(std::string name) const;
60
70 template<typename T>
71 T GetAttribute(std::string name) const
72 {
73 return impl.Get()->GetAttribute<T>(name);
74 }
75
81 std::vector<std::string> GetAttributes() const;
82
88 std::string GetConsistentId() const;
89
95 const std::vector<std::string>& GetHostNames() const;
96
102 Guid GetId() const;
103
109 bool IsClient() const;
110
116 bool IsDaemon() const;
117
123 bool IsLocal() const;
124
130 int64_t GetOrder() const;
131
137 const IgniteProductVersion& GetVersion() const;
138
146 friend IGNITE_IMPORT_EXPORT bool operator<(const ClusterNode& lnode, const ClusterNode& rnode)
147 {
148 return lnode.GetId() < rnode.GetId();
149 }
150
151 private:
152 common::concurrent::SharedPointer<ignite::impl::cluster::ClusterNodeImpl> impl;
153 };
154 }
155 }
156
157 #endif //_IGNITE_CLUSTER_CLUSTER_NODE
ignite
Apache Ignite API.
Definition: cache.h:48
ignite::IgniteProductVersion
Ignite product version.
Definition: ignite_product_version.h:36
ignite::Guid
Global universally unique identifier (GUID).
Definition: guid.h:36
ignite::cluster::ClusterNode::GetId
Guid GetId() const
Get globally unique node ID.
Definition: cluster_node.cpp:58
ignite::cluster::ClusterNode::GetAttribute
T GetAttribute(std::string name) const
Get a node attribute.
Definition: cluster_node.h:71
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:146
ignite::cluster::ClusterNode
Interface representing a single cluster node.
Definition: cluster_node.h:36