| 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/compute/compute_client.h>
33 #include <ignite/thin/transactions/transactions.h>
34
35 namespace ignite
36 {
37 namespace thin
38 {
49 class IGNITE_IMPORT_EXPORT IgniteClient
50 {
51 typedef common::concurrent::SharedPointer<void> SP_Void;
52 public:
56 IgniteClient()
57 {
58 // No-op.
59 }
60
64 ~IgniteClient();
65
73 static IgniteClient Start(const IgniteClientConfiguration& cfg);
74
81 template<typename K, typename V>
82 cache::CacheClient<K, V> GetCache(const char* name)
83 {
84 return cache::CacheClient<K, V>(InternalGetCache(name));
85 }
86
93 template<typename K, typename V>
94 cache::CacheClient<K, V> GetOrCreateCache(const char* name)
95 {
96 return cache::CacheClient<K, V>(InternalGetOrCreateCache(name));
97 }
98
105 template<typename K, typename V>
106 cache::CacheClient<K, V> CreateCache(const char* name)
107 {
108 return cache::CacheClient<K, V>(InternalCreateCache(name));
109 }
110
116 void DestroyCache(const char* name);
117
124 void GetCacheNames(std::vector<std::string>& cacheNames);
125
129 transactions::ClientTransactions ClientTransactions()
130 {
131 return transactions::ClientTransactions(InternalTransactions());
132 }
133
137 compute::ComputeClient GetCompute()
138 {
139 return compute::ComputeClient(InternalCompute());
140 }
141
142 private:
150 SP_Void InternalGetCache(const char* name);
151
159 SP_Void InternalGetOrCreateCache(const char* name);
160
168 SP_Void InternalCreateCache(const char* name);
169
176 SP_Void InternalTransactions();
177
184 SP_Void InternalCompute();
185
191 IgniteClient(SP_Void& impl);
192
194 SP_Void impl;
195 };
196 }
197 }
198
199 #endif // _IGNITE_THIN_IGNITE_CLIENT
ignite_client_configuration.h
ignite::thin::IgniteClient::CreateCache
cache::CacheClient< K, V > CreateCache(const char *name)
Create cache.
Definition: ignite_client.h:106
ignite
Apache Ignite API.
Definition: cache.h:48
ignite::thin::IgniteClient::GetCompute
compute::ComputeClient GetCompute()
Get client compute API.
Definition: ignite_client.h:137
cache_client.h
ignite::thin::compute::ComputeClient
Client Compute API.
Definition: compute_client.h:53
ignite::thin::IgniteClient::IgniteClient
IgniteClient()
Default constructor.
Definition: ignite_client.h:56
ignite::thin::IgniteClient::GetOrCreateCache
cache::CacheClient< K, V > GetOrCreateCache(const char *name)
Get or create cache.
Definition: ignite_client.h:94
compute_client.h
ignite::thin::IgniteClient::ClientTransactions
transactions::ClientTransactions ClientTransactions()
Starts transactions.
Definition: ignite_client.h:129
ignite::thin::cache::CacheClient
Cache client class template.
Definition: cache_client.h:64
ignite::thin::IgniteClientConfiguration
Ignite thin client configuration.
Definition: ignite_client_configuration.h:39
ignite::thin::IgniteClient::GetCache
cache::CacheClient< K, V > GetCache(const char *name)
Get cache.
Definition: ignite_client.h:82
ignite::thin::transactions::ClientTransactions
Transactions client.
Definition: thin-client/include/ignite/thin/transactions/transactions.h:43
ignite::thin::IgniteClient
Ignite client class.
Definition: ignite_client.h:49