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/cache/cache.h"
28 #include "ignite/impl/ignite_impl.h"
30 
31 namespace ignite
32 {
41  class IGNITE_IMPORT_EXPORT Ignite
42  {
43  friend class impl::IgniteImpl;
44  public:
48  Ignite();
49 
53  Ignite(impl::IgniteImpl* impl);
54 
60  const char* GetName() const;
61 
70  template<typename K, typename V>
71  cache::Cache<K, V> GetCache(const char* name)
72  {
73  IgniteError err;
74 
75  cache::Cache<K, V> res = GetCache<K, V>(name, &err);
76 
78 
79  return res;
80  }
81 
91  template<typename K, typename V>
92  cache::Cache<K, V> GetCache(const char* name, IgniteError* err)
93  {
94  impl::cache::CacheImpl* cacheImpl = impl.Get()->GetCache<K, V>(name, *err);
95 
96  return cache::Cache<K, V>(cacheImpl);
97  }
98 
107  template<typename K, typename V>
109  {
110  IgniteError err;
111 
112  cache::Cache<K, V> res = GetOrCreateCache<K, V>(name, &err);
113 
115 
116  return res;
117  }
118 
128  template<typename K, typename V>
130  {
131  impl::cache::CacheImpl* cacheImpl = impl.Get()->GetOrCreateCache<K, V>(name, *err);
132 
133  return cache::Cache<K, V>(cacheImpl);
134  }
135 
144  template<typename K, typename V>
145  cache::Cache<K, V> CreateCache(const char* name)
146  {
147  IgniteError err;
148 
149  cache::Cache<K, V> res = CreateCache<K, V>(name, &err);
150 
152 
153  return res;
154  }
155 
165  template<typename K, typename V>
167  {
168  impl::cache::CacheImpl* cacheImpl = impl.Get()->CreateCache<K, V>(name, *err);
169 
170  return cache::Cache<K, V>(cacheImpl);
171  }
172 
180  transactions::Transactions GetTransactions();
181 
193  bool IsValid() const
194  {
195  return impl.IsValid();
196  }
197 
198  private:
200  ignite::common::concurrent::SharedPointer<impl::IgniteImpl> impl;
201  };
202 }
203 
204 #endif //_IGNITE_IGNITE
cache::Cache< K, V > GetCache(const char *name)
Get cache.
Definition: ignite.h:71
bool IsValid() const
Check if the instance is valid.
Definition: ignite.h:193
Main entry point for all Data Grid APIs.
Definition: cache.h:60
cache::Cache< K, V > GetOrCreateCache(const char *name)
Get or create cache.
Definition: ignite.h:108
Declares ignite::IgniteConfiguration class.
cache::Cache< K, V > CreateCache(const char *name)
Create cache.
Definition: ignite.h:145
cache::Cache< K, V > CreateCache(const char *name, IgniteError *err)
Create cache.
Definition: ignite.h:166
Transactions facade.
Definition: transactions.h:45
Declares ignite::cache::Cache class.
Ignite error information.
Definition: ignite_error.h:94
Declares ignite::transactions::Transactions class.
Apache Ignite API.
Definition: cache.h:43
cache::Cache< K, V > GetOrCreateCache(const char *name, IgniteError *err)
Get or create cache.
Definition: ignite.h:129
Main interface to operate with Ignite.
Definition: ignite.h:41
static void ThrowIfNeeded(const IgniteError &err)
Throw an error if code is not IGNITE_SUCCESS.
Definition: ignite_error.cpp:27
cache::Cache< K, V > GetCache(const char *name, IgniteError *err)
Get cache.
Definition: ignite.h:92