Infinispan HotRod C++ Client 9.2.0.Final
Loading...
Searching...
No Matches
ClientEvent.h
Go to the documentation of this file.
1/*
2 * ClientEvent.h
3 *
4 * Created on: Aug 19, 2016
5 * Author: rigazilla
6 */
7
8#ifndef SRC_HOTROD_IMPL_EVENT_CLIENTEVENT_H_
9#define SRC_HOTROD_IMPL_EVENT_CLIENTEVENT_H_
10
11#include <vector>
12#include <cstdint>
13
14namespace infinispan {
15namespace hotrod {
16namespace event {
17
18struct EventHeaderParams {
19 uint8_t magic;
20 uint64_t messageId;
21 uint8_t opCode;
22 uint8_t status;
23};
24
26public:
27 enum Type {
31 };
32
33 virtual uint8_t getType() = 0;
34 virtual ~ClientEvent() {}
35};
36
37template <class K>
39{
40public:
41 ClientCacheEntryCreatedEvent(K key, uint64_t version, int commandRetried) : key(key), version(version), commandRetried(commandRetried!=0) {}
46 K getKey() { return key; }
47
52 uint64_t getVersion() { return version; }
53
62 bool isCommandRetried() { return commandRetried; }
63 uint8_t getType() { return CLIENT_CACHE_ENTRY_CREATED; }
64private:
65 const K key;
66 const uint64_t version;
67 const bool commandRetried;
68};
69
70template <class K>
72public:
73 ClientCacheEntryModifiedEvent(K key, uint64_t version, int commandRetried) : key(key), version(version), commandRetried(commandRetried!=0) {}
74
79 K getKey() { return key; }
80
85 uint64_t getVersion() { return version; }
86
95 bool isCommandRetried() { return commandRetried; }
97private:
98 const K key;
99 const uint64_t version;
100 const bool commandRetried;
101};
102
103template <class K>
105public:
112 K getKey() { return key; }
113
115private:
116 const K key;
117};
118
119template <class K>
121public:
122 ClientCacheEntryRemovedEvent(K key, int commandRetried) : key(key), commandRetried(commandRetried!=0) {}
128 K getKey() { return key; }
129
138 bool isCommandRetried() { return commandRetried; }
140private:
141 const K key;
142 const bool commandRetried;
143};
144
146public:
147 ClientCacheEntryCustomEvent(std::vector<char> data, int commandRetried) : data(data), commandRetried(commandRetried!=0) {}
154 std::vector<char> getEventData() { return data; }
155
164 bool isCommandRetried() { return commandRetried; }
165 uint8_t getType() { return CLIENT_CACHE_ENTRY_CUSTOM; }
166private:
167 const std::vector<char> data;
168 bool commandRetried;
169};
170
172 uint8_t getType() { return CLIENT_CACHE_FAILOVER; }
173
174};
175
176
177} /* namespace event */
178} /* namespace hotrod */
179} /* namespace infinispan */
180
181#endif /* SRC_HOTROD_IMPL_EVENT_CLIENTEVENT_H_ */
ClientCacheEntryCreatedEvent(K key, uint64_t version, int commandRetried)
Definition: ClientEvent.h:41
bool isCommandRetried()
Definition: ClientEvent.h:62
uint8_t getType()
Definition: ClientEvent.h:63
uint64_t getVersion()
Definition: ClientEvent.h:52
bool isCommandRetried()
Definition: ClientEvent.h:164
ClientCacheEntryCustomEvent(std::vector< char > data, int commandRetried)
Definition: ClientEvent.h:147
std::vector< char > getEventData()
Definition: ClientEvent.h:154
uint8_t getType()
Definition: ClientEvent.h:165
ClientCacheEntryExpiredEvent(K key)
Definition: ClientEvent.h:106
uint8_t getType()
Definition: ClientEvent.h:114
uint8_t getType()
Definition: ClientEvent.h:96
bool isCommandRetried()
Definition: ClientEvent.h:95
uint64_t getVersion()
Definition: ClientEvent.h:85
ClientCacheEntryModifiedEvent(K key, uint64_t version, int commandRetried)
Definition: ClientEvent.h:73
uint8_t getType()
Definition: ClientEvent.h:139
ClientCacheEntryRemovedEvent(K key, int commandRetried)
Definition: ClientEvent.h:122
bool isCommandRetried()
Definition: ClientEvent.h:138
Definition: ClientEvent.h:25
Type
Definition: ClientEvent.h:27
@ CLIENT_CACHE_ENTRY_REMOVED
Definition: ClientEvent.h:29
@ CLIENT_CACHE_FAILOVER
Definition: ClientEvent.h:30
@ CLIENT_CACHE_ENTRY_CREATED
Definition: ClientEvent.h:28
@ CLIENT_CACHE_ENTRY_CUSTOM
Definition: ClientEvent.h:29
@ CLIENT_CACHE_ENTRY_MODIFIED
Definition: ClientEvent.h:28
@ CLIENT_CACHE_ENTRY_EXPIRED
Definition: ClientEvent.h:29
virtual ~ClientEvent()
Definition: ClientEvent.h:34
Definition: AuthenticationConfiguration.h:10