GridGain C++
ignite.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_IGNITE
23 #define _IGNITE_IGNITE
24 
25 #include <ignite/impl/ignite_impl.h>
26 
28 #include <ignite/cache/cache.h>
31 #include <ignite/compute/compute.h>
33 
34 namespace ignite
35 {
44  class IGNITE_IMPORT_EXPORT Ignite
45  {
46  friend class impl::IgniteImpl;
47  public:
51  Ignite();
52 
56  Ignite(impl::IgniteImpl* impl);
57 
66  template<typename K>
67  cache::CacheAffinity<K> GetAffinity(const std::string& cacheName)
68  {
69  IgniteError err;
70 
71  cache::CacheAffinity<K> ret(impl.Get()->GetAffinity(cacheName, err));
72 
74 
75  return ret;
76  }
77 
83  const char* GetName() const;
84 
92  const IgniteConfiguration& GetConfiguration() const;
93 
102  template<typename K, typename V>
103  cache::Cache<K, V> GetCache(const char* name)
104  {
105  IgniteError err;
106 
107  cache::Cache<K, V> res = GetCache<K, V>(name, err);
108 
110 
111  return res;
112  }
113 
123  template<typename K, typename V>
124  cache::Cache<K, V> GetCache(const char* name, IgniteError& err)
125  {
126  impl::cache::CacheImpl* cacheImpl = impl.Get()->GetCache(name, err);
127 
128  return cache::Cache<K, V>(cacheImpl);
129  }
130 
139  template<typename K, typename V>
141  {
142  IgniteError err;
143 
144  cache::Cache<K, V> res = GetOrCreateCache<K, V>(name, err);
145 
147 
148  return res;
149  }
150 
160  template<typename K, typename V>
162  {
163  impl::cache::CacheImpl* cacheImpl = impl.Get()->GetOrCreateCache(name, err);
164 
165  return cache::Cache<K, V>(cacheImpl);
166  }
167 
176  template<typename K, typename V>
177  cache::Cache<K, V> CreateCache(const char* name)
178  {
179  IgniteError err;
180 
181  cache::Cache<K, V> res = CreateCache<K, V>(name, err);
182 
184 
185  return res;
186  }
187 
197  template<typename K, typename V>
199  {
200  impl::cache::CacheImpl* cacheImpl = impl.Get()->CreateCache(name, err);
201 
202  return cache::Cache<K, V>(cacheImpl);
203  }
204 
210  bool IsActive();
211 
218  void SetActive(bool active);
219 
227  transactions::Transactions GetTransactions();
228 
236  cluster::IgniteCluster GetCluster();
237 
245  compute::Compute GetCompute();
246 
257  compute::Compute GetCompute(cluster::ClusterGroup grp);
258 
266  IgniteBinding GetBinding();
267 
279  bool IsValid() const
280  {
281  return impl.IsValid();
282  }
283 
284  private:
286  ignite::common::concurrent::SharedPointer<impl::IgniteImpl> impl;
287  };
288 }
289 
290 #endif //_IGNITE_IGNITE
ignite::IgniteBinding
Ignite Binding.
Definition: ignite_binding.h:37
ignite::compute::Compute
Defines compute grid functionality for executing tasks and closures over nodes in the ClusterGroup.
Definition: compute.h:73
ignite::transactions::Transactions
Transactions facade.
Definition: core/include/ignite/transactions/transactions.h:44
ignite
Ignite API.
Definition: cache.h:47
cache_affinity.h
ignite::Ignite::IsValid
bool IsValid() const
Check if the instance is valid.
Definition: ignite.h:279
ignite::Ignite::CreateCache
cache::Cache< K, V > CreateCache(const char *name, IgniteError &err)
Create cache.
Definition: ignite.h:198
ignite::cache::Cache
Main entry point for all Data Grid APIs.
Definition: cache.h:67
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:67
ignite::Ignite
Main interface to operate with Ignite.
Definition: ignite.h:44
ignite::cluster::ClusterGroup
Defines a cluster group which contains all or a subset of cluster nodes.
Definition: cluster_group.h:44
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:41
ignite::Ignite::GetOrCreateCache
cache::Cache< K, V > GetOrCreateCache(const char *name, IgniteError &err)
Get or create cache.
Definition: ignite.h:161
ignite::Ignite::GetCache
cache::Cache< K, V > GetCache(const char *name, IgniteError &err)
Get cache.
Definition: ignite.h:124
ignite::Ignite::CreateCache
cache::Cache< K, V > CreateCache(const char *name)
Create cache.
Definition: ignite.h:177
cache.h
ignite::IgniteConfiguration
Ignite configuration.
Definition: ignite_configuration.h:34
ignite::IgniteError::ThrowIfNeeded
static void ThrowIfNeeded(const IgniteError &err)
Throw an error if code is not IGNITE_SUCCESS.
Definition: ignite_error.cpp:26
ignite_configuration.h
ignite::cluster::IgniteCluster
Represents whole cluster (all available nodes).
Definition: ignite_cluster.h:38
transactions.h
ignite::IgniteError
Ignite error information.
Definition: ignite_error.h:93
ignite::Ignite::GetCache
cache::Cache< K, V > GetCache(const char *name)
Get cache.
Definition: ignite.h:103
ignite::Ignite::GetOrCreateCache
cache::Cache< K, V > GetOrCreateCache(const char *name)
Get or create cache.
Definition: ignite.h:140