| Apache Ignite C++

ignite.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_IGNITE
24 #define _IGNITE_IGNITE
25
26 #include <ignite/impl/ignite_impl.h>
27
28 #include <ignite/ignite_configuration.h>
29 #include <ignite/cache/cache.h>
30 #include <ignite/cache/cache_affinity.h>
31 #include <ignite/transactions/transactions.h>
32 #include <ignite/compute/compute.h>
33 #include <ignite/cluster/ignite_cluster.h>
34
35 namespace ignite
36 {
45 class IGNITE_IMPORT_EXPORT Ignite
46 {
47 friend class impl::IgniteImpl;
48 public:
52 Ignite();
53
57 Ignite(impl::IgniteImpl* impl);
58
67 template<typename K>
68 cache::CacheAffinity<K> GetAffinity(const std::string& cacheName)
69 {
70 IgniteError err;
71
72 cache::CacheAffinity<K> ret(impl.Get()->GetAffinity(cacheName, err));
73
74 IgniteError::ThrowIfNeeded(err);
75
76 return ret;
77 }
78
84 const char* GetName() const;
85
93 const IgniteConfiguration& GetConfiguration() const;
94
103 template<typename K, typename V>
104 cache::Cache<K, V> GetCache(const char* name)
105 {
106 IgniteError err;
107
108 cache::Cache<K, V> res = GetCache<K, V>(name, err);
109
110 IgniteError::ThrowIfNeeded(err);
111
112 return res;
113 }
114
124 template<typename K, typename V>
125 cache::Cache<K, V> GetCache(const char* name, IgniteError& err)
126 {
127 impl::cache::CacheImpl* cacheImpl = impl.Get()->GetCache(name, err);
128
129 return cache::Cache<K, V>(cacheImpl);
130 }
131
140 template<typename K, typename V>
141 cache::Cache<K, V> GetOrCreateCache(const char* name)
142 {
143 IgniteError err;
144
145 cache::Cache<K, V> res = GetOrCreateCache<K, V>(name, err);
146
147 IgniteError::ThrowIfNeeded(err);
148
149 return res;
150 }
151
161 template<typename K, typename V>
162 cache::Cache<K, V> GetOrCreateCache(const char* name, IgniteError& err)
163 {
164 impl::cache::CacheImpl* cacheImpl = impl.Get()->GetOrCreateCache(name, err);
165
166 return cache::Cache<K, V>(cacheImpl);
167 }
168
177 template<typename K, typename V>
178 cache::Cache<K, V> CreateCache(const char* name)
179 {
180 IgniteError err;
181
182 cache::Cache<K, V> res = CreateCache<K, V>(name, err);
183
184 IgniteError::ThrowIfNeeded(err);
185
186 return res;
187 }
188
198 template<typename K, typename V>
199 cache::Cache<K, V> CreateCache(const char* name, IgniteError& err)
200 {
201 impl::cache::CacheImpl* cacheImpl = impl.Get()->CreateCache(name, err);
202
203 return cache::Cache<K, V>(cacheImpl);
204 }
205
211 bool IsActive();
212
219 void SetActive(bool active);
220
228 transactions::Transactions GetTransactions();
229
237 cluster::IgniteCluster GetCluster();
238
246 compute::Compute GetCompute();
247
258 compute::Compute GetCompute(cluster::ClusterGroup grp);
259
267 IgniteBinding GetBinding();
268
280 bool IsValid() const
281 {
282 return impl.IsValid();
283 }
284
285 private:
287 ignite::common::concurrent::SharedPointer<impl::IgniteImpl> impl;
288 };
289 }
290
291 #endif //_IGNITE_IGNITE
ignite::IgniteBinding
Ignite Binding.
Definition: ignite_binding.h:38
ignite::compute::Compute
Defines compute grid functionality for executing tasks and closures over nodes in the ClusterGroup.
Definition: compute.h:74
ignite::transactions::Transactions
Transactions facade.
Definition: core/include/ignite/transactions/transactions.h:45
ignite
Apache Ignite API.
Definition: cache.h:48
cache_affinity.h
ignite::Ignite::IsValid
bool IsValid() const
Check if the instance is valid.
Definition: ignite.h:280
ignite::Ignite::CreateCache
cache::Cache< K, V > CreateCache(const char *name, IgniteError &err)
Create cache.
Definition: ignite.h:199
ignite::cache::Cache
Main entry point for all Data Grid APIs.
Definition: cache.h:68
ignite::Ignite::GetAffinity
cache::CacheAffinity< K > GetAffinity(const std::string &cacheName)
Get affinity service to provide information about data partitioning and distribution.
Definition: ignite.h:68
ignite::Ignite
Main interface to operate with Ignite.
Definition: ignite.h:45
ignite::cluster::ClusterGroup
Defines a cluster group which contains all or a subset of cluster nodes.
Definition: cluster_group.h:45
compute.h
ignite_cluster.h
ignite::cache::CacheAffinity
Provides affinity information to detect which node is primary and which nodes are backups for a parti...
Definition: cache_affinity.h:42
ignite::Ignite::GetOrCreateCache
cache::Cache< K, V > GetOrCreateCache(const char *name, IgniteError &err)
Get or create cache.
Definition: ignite.h:162
ignite::Ignite::GetCache
cache::Cache< K, V > GetCache(const char *name, IgniteError &err)
Get cache.
Definition: ignite.h:125
ignite::Ignite::CreateCache
cache::Cache< K, V > CreateCache(const char *name)
Create cache.
Definition: ignite.h:178
cache.h
ignite::IgniteConfiguration
Ignite configuration.
Definition: ignite_configuration.h:35
ignite::IgniteError::ThrowIfNeeded
static void ThrowIfNeeded(const IgniteError &err)
Throw an error if code is not IGNITE_SUCCESS.
Definition: ignite_error.cpp:27
ignite_configuration.h
ignite::cluster::IgniteCluster
Represents whole cluster (all available nodes).
Definition: ignite_cluster.h:39
transactions.h
ignite::IgniteError
Ignite error information.
Definition: ignite_error.h:94
ignite::Ignite::GetCache
cache::Cache< K, V > GetCache(const char *name)
Get cache.
Definition: ignite.h:104
ignite::Ignite::GetOrCreateCache
cache::Cache< K, V > GetOrCreateCache(const char *name)
Get or create cache.
Definition: ignite.h:141