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 
29 #include <ignite/cache/cache.h>
31 #include <ignite/compute/compute.h>
32 
33 namespace ignite
34 {
43  class IGNITE_IMPORT_EXPORT Ignite
44  {
45  friend class impl::IgniteImpl;
46  public:
50  Ignite();
51 
55  Ignite(impl::IgniteImpl* impl);
56 
62  const char* GetName() const;
63 
71  const IgniteConfiguration& GetConfiguration() const;
72 
81  template<typename K, typename V>
82  cache::Cache<K, V> GetCache(const char* name)
83  {
84  IgniteError err;
85 
86  cache::Cache<K, V> res = GetCache<K, V>(name, err);
87 
89 
90  return res;
91  }
92 
102  template<typename K, typename V>
103  cache::Cache<K, V> GetCache(const char* name, IgniteError& err)
104  {
105  impl::cache::CacheImpl* cacheImpl = impl.Get()->GetCache(name, err);
106 
107  return cache::Cache<K, V>(cacheImpl);
108  }
109 
118  template<typename K, typename V>
120  {
121  IgniteError err;
122 
123  cache::Cache<K, V> res = GetOrCreateCache<K, V>(name, err);
124 
126 
127  return res;
128  }
129 
139  template<typename K, typename V>
141  {
142  impl::cache::CacheImpl* cacheImpl = impl.Get()->GetOrCreateCache(name, err);
143 
144  return cache::Cache<K, V>(cacheImpl);
145  }
146 
155  template<typename K, typename V>
156  cache::Cache<K, V> CreateCache(const char* name)
157  {
158  IgniteError err;
159 
160  cache::Cache<K, V> res = CreateCache<K, V>(name, err);
161 
163 
164  return res;
165  }
166 
176  template<typename K, typename V>
178  {
179  impl::cache::CacheImpl* cacheImpl = impl.Get()->CreateCache(name, err);
180 
181  return cache::Cache<K, V>(cacheImpl);
182  }
183 
189  bool IsActive();
190 
197  void SetActive(bool active);
198 
206  transactions::Transactions GetTransactions();
207 
215  compute::Compute GetCompute();
216 
224  IgniteBinding GetBinding();
225 
237  bool IsValid() const
238  {
239  return impl.IsValid();
240  }
241 
242  private:
244  ignite::common::concurrent::SharedPointer<impl::IgniteImpl> impl;
245  };
246 }
247 
248 #endif //_IGNITE_IGNITE
cache::Cache< K, V > GetCache(const char *name)
Get cache.
Definition: ignite.h:82
bool IsValid() const
Check if the instance is valid.
Definition: ignite.h:237
Main entry point for all Data Grid APIs.
Definition: cache.h:68
cache::Cache< K, V > GetOrCreateCache(const char *name)
Get or create cache.
Definition: ignite.h:119
Declares ignite::IgniteConfiguration class.
Defines compute grid functionality for executing tasks and closures over nodes in the ClusterGroup...
Definition: compute.h:74
Ignite Binding.
Definition: ignite_binding.h:33
cache::Cache< K, V > CreateCache(const char *name)
Create cache.
Definition: ignite.h:156
Ignite configuration.
Definition: ignite_configuration.h:35
Transactions facade.
Definition: transactions.h:45
cache::Cache< K, V > GetCache(const char *name, IgniteError &err)
Get cache.
Definition: ignite.h:103
Declares ignite::cache::Cache class.
Declares ignite::compute::Compute class.
cache::Cache< K, V > GetOrCreateCache(const char *name, IgniteError &err)
Get or create cache.
Definition: ignite.h:140
Ignite error information.
Definition: ignite_error.h:94
cache::Cache< K, V > CreateCache(const char *name, IgniteError &err)
Create cache.
Definition: ignite.h:177
Declares ignite::transactions::Transactions class.
Apache Ignite API.
Definition: cache.h:48
Main interface to operate with Ignite.
Definition: ignite.h:43
static void ThrowIfNeeded(const IgniteError &err)
Throw an error if code is not IGNITE_SUCCESS.
Definition: ignite_error.cpp:27