13#include <immer/map.hpp>
14#include <zug/transducer/filter.hpp>
15#include <zug/transducer/eager.hpp>
16#include <lager/deps.hpp>
17#include <boost/container_hash/hash.hpp>
18#include <boost/serialization/string.hpp>
29 template<
class K,
class V,
class List,
class Func>
30 immer::map<K, V>
merge(immer::map<K, V> map, List list, Func keyOf)
34 map = std::move(map).set(key, v);
61 template<
class Archive>
71 template<
class Context>
74 return lager::get<JobInterface &>(std::forward<Context>(ctx));
77 template<
class Context>
80 return lager::get<EventInterface &>(std::forward<Context>(ctx));
105 template<
class ImmerT1,
class RangeT2,
class Pred,
class Func>
108 auto cmp = [=](
auto a,
auto b) {
109 return keyOf(a) < keyOf(b);
112 for (
auto item : addon) {
118 auto it = std::upper_bound(base.begin(), base.end(), item, cmp);
124 if (it.index() != 0 && keyOf(item) == keyOf(*(it - 1))) {
127 auto index = it.index();
128 base = std::move(base).insert(index, item);
136 std::string
getTxnId(Event event, ClientModel &m);
141 template<>
struct hash<
Kazv::KeyOfState>
144 std::size_t seed = 0;
145 boost::hash_combine(seed, k.type);
146 boost::hash_combine(seed, k.stateKey);
152#define KAZV_WRAP_ATTR(_type, _d, _attr) \
153 inline auto _attr() const { \
154 KAZV_VERIFY_THREAD_ID(); \
155 return (_d)[&_type::_attr]; \
Definition context.hpp:130
Definition eventinterface.hpp:15
std::string stateKey() const
Definition event.cpp:74
std::string type() const
Definition event.cpp:62
std::string id() const
returns the id of this event
Definition event.cpp:42
std::string sender() const
Definition event.cpp:49
Definition location.hpp:10
EventInterface & getEventEmitter(Context &&ctx)
Definition clientutil.hpp:78
std::string increaseTxnId(std::string cur)
Definition clientutil.cpp:14
std::string keyOfAccountData(Event e)
Definition clientutil.hpp:43
JobInterface & getJobHandler(Context &&ctx)
Definition clientutil.hpp:72
ImmerT1 sortedUniqueMerge(ImmerT1 base, RangeT2 addon, Pred exists, Func keyOf)
Merge addon into the sorted container base.
Definition clientutil.hpp:106
std::string getTxnId(Event, ClientModel &m)
Definition clientutil.cpp:19
KeyOfState keyOfState(Event e)
Definition clientutil.hpp:67
std::string keyOfEphemeral(Event e)
Definition clientutil.hpp:51
std::string keyOfPresence(Event e)
Definition clientutil.hpp:39
immer::map< K, V > merge(immer::map< K, V > map, List list, Func keyOf)
Definition clientutil.hpp:30
std::string keyOfTimeline(Event e)
Definition clientutil.hpp:47
void serialize(Archive &ar, ClientModel &m, std::uint32_t const version)
Definition client-model.hpp:633
Definition clientutil.hpp:140
Definition jobinterface.hpp:21
Definition clientutil.hpp:56
std::string type
Definition clientutil.hpp:57
std::string stateKey
Definition clientutil.hpp:58
friend bool operator==(const KeyOfState &a, const KeyOfState &b)=default
std::size_t operator()(const Kazv::KeyOfState &k) const noexcept
Definition clientutil.hpp:143