| Apache Ignite C++

ignite_client.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_THIN_IGNITE_CLIENT
24 #define _IGNITE_THIN_IGNITE_CLIENT
25
26 #include <vector>
27
28 #include <ignite/common/concurrent.h>
29
30 #include <ignite/thin/ignite_client_configuration.h>
31 #include <ignite/thin/cache/cache_client.h>
32 #include <ignite/thin/transactions/transactions.h>
33
34 namespace ignite
35 {
36 namespace thin
37 {
48 class IGNITE_IMPORT_EXPORT IgniteClient
49 {
50 typedef common::concurrent::SharedPointer<void> SP_Void;
51 public:
55 IgniteClient()
56 {
57 // No-op.
58 }
59
63 ~IgniteClient();
64
72 static IgniteClient Start(const IgniteClientConfiguration& cfg);
73
80 template<typename K, typename V>
81 cache::CacheClient<K, V> GetCache(const char* name)
82 {
83 return cache::CacheClient<K, V>(InternalGetCache(name));
84 }
85
92 template<typename K, typename V>
93 cache::CacheClient<K, V> GetOrCreateCache(const char* name)
94 {
95 return cache::CacheClient<K, V>(InternalGetOrCreateCache(name));
96 }
97
104 template<typename K, typename V>
105 cache::CacheClient<K, V> CreateCache(const char* name)
106 {
107 return cache::CacheClient<K, V>(InternalCreateCache(name));
108 }
109
115 void DestroyCache(const char* name);
116
123 void GetCacheNames(std::vector<std::string>& cacheNames);
124
128 transactions::ClientTransactions ClientTransactions()
129 {
130 return transactions::ClientTransactions(InternalTransactions());
131 }
132
133 private:
141 SP_Void InternalGetCache(const char* name);
142
150 SP_Void InternalGetOrCreateCache(const char* name);
151
159 SP_Void InternalCreateCache(const char* name);
160
162 SP_Void InternalTransactions();
163
169 IgniteClient(SP_Void& impl);
170
172 SP_Void impl;
173 };
174 }
175 }
176
177 #endif // _IGNITE_THIN_IGNITE_CLIENT
cache_client.h
Declares ignite::thin::cache::CacheClient.
ignite::thin::IgniteClient::GetOrCreateCache
cache::CacheClient< K, V > GetOrCreateCache(const char *name)
Get or create cache.
Definition: ignite_client.h:93
ignite::thin::IgniteClient::GetCache
cache::CacheClient< K, V > GetCache(const char *name)
Get cache.
Definition: ignite_client.h:81
ignite::thin::IgniteClient::IgniteClient
IgniteClient()
Default constructor.
Definition: ignite_client.h:55
ignite::thin::IgniteClientConfiguration
Ignite thin client configuration.
Definition: ignite_client_configuration.h:39
ignite::thin::cache::CacheClient
Cache client class template.
Definition: cache_client.h:59
ignite::thin::IgniteClient::CreateCache
cache::CacheClient< K, V > CreateCache(const char *name)
Create cache.
Definition: ignite_client.h:105
ignite::thin::transactions::ClientTransactions
Transactions client.
Definition: thin-client/include/ignite/thin/transactions/transactions.h:43
ignite_client_configuration.h
Declares ignite::thin::IgniteClientConfiguration class.
ignite
Apache Ignite API.
Definition: cache.h:48
ignite::thin::IgniteClient
Ignite client class.
Definition: ignite_client.h:48
ignite::thin::IgniteClient::ClientTransactions
transactions::ClientTransactions ClientTransactions()
Starts transactions.
Definition: ignite_client.h:128