| Apache Ignite C++

continuous_query.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_CACHE_QUERY_CONTINUOUS_CONTINUOUS_QUERY
24 #define _IGNITE_CACHE_QUERY_CONTINUOUS_CONTINUOUS_QUERY
25
26 #include <ignite/impl/cache/query/continuous/continuous_query_impl.h>
27
28 #include <ignite/cache/event/cache_entry_event_listener.h>
29 #include <ignite/cache/event/cache_entry_event_filter.h>
30
31 namespace ignite
32 {
33 namespace cache
34 {
35 // Forward-declaration.
36 template<typename K, typename V>
37 class IGNITE_IMPORT_EXPORT Cache;
38
39 namespace query
40 {
41 namespace continuous
42 {
57 template<typename K, typename V>
58 class ContinuousQuery
59 {
60 friend class Cache<K, V>;
61 public:
62
66 enum { DEFAULT_BUFFER_SIZE = 1 };
67
71 enum { DEFAULT_TIME_INTERVAL = 0 };
72
76 ~ContinuousQuery()
77 {
78 // No-op.
79 }
80
87 ContinuousQuery(Reference<event::CacheEntryEventListener<K, V> > lsnr) :
88 impl(new impl::cache::query::continuous::ContinuousQueryImpl<K, V>(lsnr, false))
89 {
90 // No-op.
91 }
92
100 ContinuousQuery(Reference<event::CacheEntryEventListener<K, V> > lsnr, bool loc) :
101 impl(new impl::cache::query::continuous::ContinuousQueryImpl<K, V>(lsnr, loc))
102 {
103 // No-op.
104 }
105
113 template<typename F>
114 ContinuousQuery(Reference<event::CacheEntryEventListener<K, V> > lsnr,
115 const Reference<F>& remoteFilter) :
116 impl(new impl::cache::query::continuous::ContinuousQueryImpl<K, V>(lsnr, false, remoteFilter))
117 {
118 // No-op.
119 }
120
129 template<typename F>
130 ContinuousQuery(Reference<event::CacheEntryEventListener<K, V> > lsnr,
131 const Reference<F>& remoteFilter, bool loc) :
132 impl(new impl::cache::query::continuous::ContinuousQueryImpl<K, V>(lsnr, loc, remoteFilter))
133 {
134 // No-op.
135 }
136
144 void SetLocal(bool val)
145 {
146 impl.Get()->SetLocal(val);
147 }
148
156 bool GetLocal() const
157 {
158 return impl.Get()->GetLocal();
159 }
160
171 void SetBufferSize(int32_t val)
172 {
173 impl.Get()->SetBufferSize(val);
174 }
175
186 int32_t GetBufferSize() const
187 {
188 return impl.Get()->GetBufferSize();
189 }
190
206 void SetTimeInterval(int64_t val)
207 {
208 impl.Get()->SetTimeInterval(val);
209 }
210
226 int64_t GetTimeInterval() const
227 {
228 return impl.Get()->GetTimeInterval();
229 }
230
238 void SetListener(Reference<event::CacheEntryEventListener<K, V> > lsnr)
239 {
240 impl.Get()->SetListener(lsnr);
241 }
242
248 const event::CacheEntryEventListener<K, V>& GetListener() const
249 {
250 return impl.Get()->GetListener();
251 }
252
258 event::CacheEntryEventListener<K, V>& GetListener()
259 {
260 return impl.Get()->GetListener();
261 }
262
263 private:
265 common::concurrent::SharedPointer<impl::cache::query::continuous::ContinuousQueryImpl<K, V> > impl;
266 };
267 }
268 }
269 }
270 }
271
272 #endif //_IGNITE_CACHE_QUERY_CONTINUOUS_CONTINUOUS_QUERY
ignite::cache::query::continuous::ContinuousQuery::SetBufferSize
void SetBufferSize(int32_t val)
Set buffer size.
Definition: continuous_query.h:171
cache_entry_event_listener.h
ignite::cache::query::continuous::ContinuousQuery::GetListener
event::CacheEntryEventListener< K, V > & GetListener()
Get cache entry event listener.
Definition: continuous_query.h:258
ignite::cache::query::continuous::ContinuousQuery::~ContinuousQuery
~ContinuousQuery()
Destructor.
Definition: continuous_query.h:76
ignite
Apache Ignite API.
Definition: cache.h:48
ignite::cache::query::continuous::ContinuousQuery::GetListener
const event::CacheEntryEventListener< K, V > & GetListener() const
Get cache entry event listener.
Definition: continuous_query.h:248
cache_entry_event_filter.h
ignite::cache::Cache
Main entry point for all Data Grid APIs.
Definition: cache.h:68
ignite::cache::query::continuous::ContinuousQuery::GetLocal
bool GetLocal() const
Get local flag.
Definition: continuous_query.h:156
ignite::cache::query::continuous::ContinuousQuery::ContinuousQuery
ContinuousQuery(Reference< event::CacheEntryEventListener< K, V > > lsnr, bool loc)
Constructor.
Definition: continuous_query.h:100
ignite::cache::query::continuous::ContinuousQuery::SetLocal
void SetLocal(bool val)
Set local flag.
Definition: continuous_query.h:144
ignite::cache::query::continuous::ContinuousQuery::ContinuousQuery
ContinuousQuery(Reference< event::CacheEntryEventListener< K, V > > lsnr)
Constructor.
Definition: continuous_query.h:87
ignite::cache::query::continuous::ContinuousQuery::SetListener
void SetListener(Reference< event::CacheEntryEventListener< K, V > > lsnr)
Set cache entry event listener.
Definition: continuous_query.h:238
ignite::cache::query::continuous::ContinuousQuery
Continuous query.
Definition: continuous_query.h:58
ignite::cache::query::continuous::ContinuousQuery::GetTimeInterval
int64_t GetTimeInterval() const
Get time interval.
Definition: continuous_query.h:226
ignite::cache::query::continuous::ContinuousQuery::ContinuousQuery
ContinuousQuery(Reference< event::CacheEntryEventListener< K, V > > lsnr, const Reference< F > &remoteFilter)
Constructor.
Definition: continuous_query.h:114
ignite::Reference
Reference class.
Definition: reference.h:35
ignite::cache::query::continuous::ContinuousQuery::SetTimeInterval
void SetTimeInterval(int64_t val)
Set time interval.
Definition: continuous_query.h:206
ignite::cache::event::CacheEntryEventListener
Cache entry event listener.
Definition: core/include/ignite/cache/event/cache_entry_event_listener.h:40
ignite::cache::query::continuous::ContinuousQuery::ContinuousQuery
ContinuousQuery(Reference< event::CacheEntryEventListener< K, V > > lsnr, const Reference< F > &remoteFilter, bool loc)
Constructor.
Definition: continuous_query.h:130
ignite::cache::query::continuous::ContinuousQuery::GetBufferSize
int32_t GetBufferSize() const
Get buffer size.
Definition: continuous_query.h:186