PrivMX Endpoint v2.7.0
Loading...
Searching...
No Matches
Events.hpp
1#ifndef _PRIVMXLIB_ENDPOINT_KVDB_EVENTS_HPP_
2#define _PRIVMXLIB_ENDPOINT_KVDB_EVENTS_HPP_
3
4#include "privmx/endpoint/core/Events.hpp"
5#include "privmx/endpoint/core/Types.hpp"
6#include "privmx/endpoint/kvdb/Types.hpp"
7
8namespace privmx {
9namespace endpoint {
10namespace kvdb {
11
16
20 std::string kvdbId;
21};
22
27
31 std::string kvdbId;
32
37
41 int64_t entries;
42};
43
48
52 std::string kvdbId;
53
57 std::string kvdbEntryKey;
58};
59
61
65 KvdbCreatedEvent() : core::Event("kvdbCreated") {}
66
72 std::string toJSON() const override;
73
77 std::shared_ptr<core::SerializedEvent> serialize() const override;
78
83};
84
85
90
94 KvdbUpdatedEvent() : core::Event("kvdbUpdated") {}
95
101 std::string toJSON() const override;
102
106 std::shared_ptr<core::SerializedEvent> serialize() const override;
107
112};
113
118
122 KvdbDeletedEvent() : core::Event("kvdbDeleted") {}
123
129 std::string toJSON() const override;
130
134 std::shared_ptr<core::SerializedEvent> serialize() const override;
135
140};
141
146
150 KvdbStatsChangedEvent() : core::Event("kvdbStatsChanged") {}
151
157 std::string toJSON() const override;
158
162 std::shared_ptr<core::SerializedEvent> serialize() const override;
163
168};
169
170
175
179 KvdbNewEntryEvent() : core::Event("kvdbNewEntry") {}
180
186 std::string toJSON() const override;
187
191 std::shared_ptr<core::SerializedEvent> serialize() const override;
192
197};
198
203
207 KvdbEntryUpdatedEvent() : core::Event("kvdbEntryUpdated") {}
208
214 std::string toJSON() const override;
215
219 std::shared_ptr<core::SerializedEvent> serialize() const override;
220
225};
226
231
235 KvdbEntryDeletedEvent() : core::Event("kvdbEntryDeleted") {}
236
242 std::string toJSON() const override;
243
247 std::shared_ptr<core::SerializedEvent> serialize() const override;
248
253};
254
258class Events {
259public:
260
267 static bool isKvdbCreatedEvent(const core::EventHolder& eventHolder);
268
276
283 static bool isKvdbUpdatedEvent(const core::EventHolder& eventHolder);
284
292
299 static bool isKvdbDeletedEvent(const core::EventHolder& eventHolder);
300
308
315 static bool isKvdbStatsEvent(const core::EventHolder& eventHolder);
316
324
331 static bool isKvdbNewEntryEvent(const core::EventHolder& eventHolder);
332
340
347 static bool isKvdbEntryUpdatedEvent(const core::EventHolder& eventHolder);
348
356
363 static bool isKvdbEntryDeletedEvent(const core::EventHolder& eventHolder);
364
372};
373
374} // namespace kvdb
375} // namespace endpoint
376} // namespace privmx
377
378#endif
Definition Events.hpp:80
Definition Events.hpp:258
static KvdbUpdatedEvent extractKvdbUpdatedEvent(const core::EventHolder &eventHolder)
static bool isKvdbStatsEvent(const core::EventHolder &eventHolder)
static KvdbEntryUpdatedEvent extractKvdbEntryUpdatedEvent(const core::EventHolder &eventHolder)
static KvdbStatsChangedEvent extractKvdbStatsEvent(const core::EventHolder &eventHolder)
static KvdbCreatedEvent extractKvdbCreatedEvent(const core::EventHolder &eventHolder)
static bool isKvdbDeletedEvent(const core::EventHolder &eventHolder)
static bool isKvdbUpdatedEvent(const core::EventHolder &eventHolder)
static bool isKvdbEntryUpdatedEvent(const core::EventHolder &eventHolder)
static bool isKvdbNewEntryEvent(const core::EventHolder &eventHolder)
static bool isKvdbCreatedEvent(const core::EventHolder &eventHolder)
static KvdbDeletedEvent extractKvdbDeletedEvent(const core::EventHolder &eventHolder)
static KvdbEntryDeletedEvent extractKvdbEntryDeletedEvent(const core::EventHolder &eventHolder)
static bool isKvdbEntryDeletedEvent(const core::EventHolder &eventHolder)
static KvdbNewEntryEvent extractKvdbNewEntryEvent(const core::EventHolder &eventHolder)
Definition Events.hpp:21
Event(const std::string &type)
std::shared_ptr< core::SerializedEvent > serialize() const override
KvdbCreatedEvent()
Definition Events.hpp:65
std::string toJSON() const override
Kvdb data
Definition Events.hpp:82
std::string kvdbId
Definition Events.hpp:52
std::string kvdbEntryKey
Definition Events.hpp:57
std::string kvdbId
Definition Events.hpp:20
KvdbDeletedEventData data
Definition Events.hpp:139
std::string toJSON() const override
KvdbDeletedEvent()
Definition Events.hpp:122
std::shared_ptr< core::SerializedEvent > serialize() const override
std::shared_ptr< core::SerializedEvent > serialize() const override
KvdbDeletedEntryEventData data
Definition Events.hpp:252
KvdbEntryDeletedEvent()
Definition Events.hpp:235
kvdb::KvdbEntry data
Definition Events.hpp:224
std::shared_ptr< core::SerializedEvent > serialize() const override
KvdbEntryUpdatedEvent()
Definition Events.hpp:207
Definition Types.hpp:127
kvdb::KvdbEntry data
Definition Events.hpp:196
KvdbNewEntryEvent()
Definition Events.hpp:179
std::shared_ptr< core::SerializedEvent > serialize() const override
std::string toJSON() const override
KvdbStatsEventData data
Definition Events.hpp:167
KvdbStatsChangedEvent()
Definition Events.hpp:150
std::shared_ptr< core::SerializedEvent > serialize() const override
std::string kvdbId
Definition Events.hpp:31
int64_t lastEntryDate
Definition Events.hpp:36
int64_t entries
Definition Events.hpp:41
KvdbUpdatedEvent()
Definition Events.hpp:94
std::string toJSON() const override
Kvdb data
Definition Events.hpp:111
std::shared_ptr< core::SerializedEvent > serialize() const override
Definition Types.hpp:15