Ditto 4.0.2
Loading...
Searching...
No Matches
LiveQueryEvent.hpp
1#ifndef _DITTO_LIVE_QUERY_EVENT_
2#define _DITTO_LIVE_QUERY_EVENT_
3
4#include "Document.hpp"
5#include "LiveQueryMove.hpp"
6
7#include <cstddef>
8#include <vector>
9
10namespace ditto {
11
16 friend class LiveQuery;
17
19 LiveQueryEvent(std::vector<Document> old_documents,
20 std::vector<std::size_t> insertions,
21 std::vector<std::size_t> deletions,
22 std::vector<std::size_t> updates,
23 std::vector<LiveQueryMove> moves);
24
25public:
34
39 std::vector<Document> old_documents;
40
45 std::vector<std::size_t> insertions;
46
51 std::vector<std::size_t> deletions;
52
57 std::vector<std::size_t> updates;
58
65 std::vector<LiveQueryMove> moves;
66
74 static uint64_t hash(std::vector<Document> const &documents);
75
85 static std::string hash_mnemonic(std::vector<Document> const &documents);
86};
87
88} // namespace ditto
89
90#endif
The events that you receive when dealing with live queries.
Definition: LiveQueryEvent.hpp:15
std::vector< Document > old_documents
A list of all of the documents that matched the live query as part of the previous update.
Definition: LiveQueryEvent.hpp:39
static uint64_t hash(std::vector< Document > const &documents)
Returns a hash that represents the set of matching documents.
Definition: LiveQueryEvent.cpp:23
std::vector< std::size_t > updates
A list of the indexes in the list of new matching documents at which already matching documents have ...
Definition: LiveQueryEvent.hpp:57
std::vector< std::size_t > deletions
A list of the indexes in the list of old matching documents at which previously matching documents ha...
Definition: LiveQueryEvent.hpp:51
bool is_initial
Returns whether or not this is the initial event for the associated live query.
Definition: LiveQueryEvent.hpp:33
static std::string hash_mnemonic(std::vector< Document > const &documents)
Returns a pattern of words that together create a mnemonic, which represents the set of matching docu...
Definition: LiveQueryEvent.cpp:28
std::vector< LiveQueryMove > moves
A list of the move objects that provide the indexes, in relation to the list of old matching document...
Definition: LiveQueryEvent.hpp:65
std::vector< std::size_t > insertions
A list of the indexes in the list of new matching documents at which new matching documents have been...
Definition: LiveQueryEvent.hpp:45
The type that is returned when calling observe_local. It handles the logic for calling the event hand...
Definition: LiveQuery.hpp:108