| Apache Ignite C++

continuous_query_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_CACHE_QUERY_CONTINUOUS_CONTINUOUS_QUERY_CLIENT
24 #define _IGNITE_THIN_CACHE_QUERY_CONTINUOUS_CONTINUOUS_QUERY_CLIENT
25
26 #include <ignite/reference.h>
27
28 #include <ignite/thin/cache/event/cache_entry_event_listener.h>
29 #include <ignite/thin/cache/event/java_cache_entry_event_filter.h>
30
31 namespace ignite
32 {
33 namespace thin
34 {
35 namespace cache
36 {
37 namespace query
38 {
39 namespace continuous
40 {
53 template<typename K, typename V>
54 class ContinuousQueryClient
55 {
56 public:
60 enum { DEFAULT_BUFFER_SIZE = 1 };
61
65 enum { DEFAULT_TIME_INTERVAL = 0 };
66
70 ~ContinuousQueryClient()
71 {
72 // No-op.
73 }
74
81 explicit ContinuousQueryClient(Reference<event::CacheEntryEventListener<K, V> > lsnr) :
82 bufferSize(DEFAULT_BUFFER_SIZE),
83 timeInterval(DEFAULT_TIME_INTERVAL),
84 includeExpired(false),
85 listener(lsnr),
86 filter()
87 {
88 // No-op.
89 }
90
100 void SetBufferSize(int32_t val)
101 {
102 bufferSize = val;
103 }
104
114 int32_t GetBufferSize() const
115 {
116 return bufferSize;
117 }
118
131 void SetTimeInterval(int64_t val)
132 {
133 timeInterval = val;
134 }
135
148 int64_t GetTimeInterval() const
149 {
150 return timeInterval;
151 }
152
163 void SetIncludeExpired(bool val)
164 {
165 includeExpired = val;
166 }
167
178 bool GetIncludeExpired() const
179 {
180 return includeExpired;
181 }
182
190 void SetListener(Reference<event::CacheEntryEventListener<K, V> > lsnr)
191 {
192 listener = lsnr;
193 }
194
200 const event::CacheEntryEventListener<K, V>& GetListener() const
201 {
202 return *listener.Get();
203 }
204
210 event::CacheEntryEventListener<K, V>& GetListener()
211 {
212 return *listener.Get();
213 }
214
221 void SetJavaFilter(const event::JavaCacheEntryEventFilter& fltr)
222 {
223 filter = fltr;
224 }
225
231 event::JavaCacheEntryEventFilter& GetJavaFilter()
232 {
233 return filter;
234 }
235
241 const event::JavaCacheEntryEventFilter& GetJavaFilter() const
242 {
243 return filter;
244 }
245
246 private:
248 int32_t bufferSize;
249
251 int64_t timeInterval;
252
254 bool includeExpired;
255
257 Reference<event::CacheEntryEventListener<K, V> > listener;
258
260 event::JavaCacheEntryEventFilter filter;
261 };
262 }
263 }
264 }
265 }
266 }
267
268 #endif //_IGNITE_THIN_CACHE_QUERY_CONTINUOUS_CONTINUOUS_QUERY_CLIENT
ignite
Apache Ignite API.
Definition: cache.h:48
ignite::thin::cache::query::continuous::ContinuousQueryClient::GetTimeInterval
int64_t GetTimeInterval() const
Get time interval.
Definition: continuous_query_client.h:148
cache_entry_event_listener.h
ignite::thin::cache::query::continuous::ContinuousQueryClient::SetIncludeExpired
void SetIncludeExpired(bool val)
Sets a value indicating whether to notify about Expired events.
Definition: continuous_query_client.h:163
ignite::thin::cache::query::continuous::ContinuousQueryClient::GetBufferSize
int32_t GetBufferSize() const
Get buffer size.
Definition: continuous_query_client.h:114
ignite::thin::cache::event::CacheEntryEventListener
Cache entry event listener.
Definition: thin-client/include/ignite/thin/cache/event/cache_entry_event_listener.h:42
ignite::thin::cache::query::continuous::ContinuousQueryClient
Continuous query client.
Definition: continuous_query_client.h:54
ignite::thin::cache::query::continuous::ContinuousQueryClient::SetTimeInterval
void SetTimeInterval(int64_t val)
Set time interval.
Definition: continuous_query_client.h:131
ignite::thin::cache::query::continuous::ContinuousQueryClient::GetJavaFilter
const event::JavaCacheEntryEventFilter & GetJavaFilter() const
Get remote Java filter reference.
Definition: continuous_query_client.h:241
java_cache_entry_event_filter.h
ignite::thin::cache::query::continuous::ContinuousQueryClient::ContinuousQueryClient
ContinuousQueryClient(Reference< event::CacheEntryEventListener< K, V > > lsnr)
Constructor.
Definition: continuous_query_client.h:81
ignite::thin::cache::query::continuous::ContinuousQueryClient::SetJavaFilter
void SetJavaFilter(const event::JavaCacheEntryEventFilter &fltr)
Set Java event filter to be used on server to determine what events should be transferred to local ev...
Definition: continuous_query_client.h:221
ignite::thin::cache::query::continuous::ContinuousQueryClient::~ContinuousQueryClient
~ContinuousQueryClient()
Destructor.
Definition: continuous_query_client.h:70
ignite::thin::cache::query::continuous::ContinuousQueryClient::GetListener
event::CacheEntryEventListener< K, V > & GetListener()
Get cache entry event listener.
Definition: continuous_query_client.h:210
reference.h
ignite::thin::cache::query::continuous::ContinuousQueryClient::SetBufferSize
void SetBufferSize(int32_t val)
Set buffer size.
Definition: continuous_query_client.h:100
ignite::thin::cache::query::continuous::ContinuousQueryClient::GetListener
const event::CacheEntryEventListener< K, V > & GetListener() const
Get cache entry event listener.
Definition: continuous_query_client.h:200
ignite::thin::cache::query::continuous::ContinuousQueryClient::SetListener
void SetListener(Reference< event::CacheEntryEventListener< K, V > > lsnr)
Set cache entry event listener.
Definition: continuous_query_client.h:190
ignite::thin::cache::query::continuous::ContinuousQueryClient::GetIncludeExpired
bool GetIncludeExpired() const
Gets a value indicating whether to notify about Expired events.
Definition: continuous_query_client.h:178
ignite::thin::cache::query::continuous::ContinuousQueryClient::GetJavaFilter
event::JavaCacheEntryEventFilter & GetJavaFilter()
Get remote Java filter reference.
Definition: continuous_query_client.h:231
ignite::Reference
Reference class.
Definition: reference.h:35
ignite::thin::cache::event::JavaCacheEntryEventFilter
Java cache entry event filter.
Definition: thin-client/include/ignite/thin/cache/event/java_cache_entry_event_filter.h:55