summaryrefslogtreecommitdiff
path: root/include/erebos/sync.h
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2021-02-21 22:16:21 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2021-02-23 22:12:41 +0100
commitc3d6046b25ef0786b8d2919dfa9db4eb05114501 (patch)
tree19af178d6305c3a83859b7d5b07dbc9b1af3aea5 /include/erebos/sync.h
parent52db636c108ab0a16ba0ccf8df55cf28142a230c (diff)
Sync service
Diffstat (limited to 'include/erebos/sync.h')
-rw-r--r--include/erebos/sync.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/erebos/sync.h b/include/erebos/sync.h
new file mode 100644
index 0000000..0b9ed9a
--- /dev/null
+++ b/include/erebos/sync.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <erebos/service.h>
+#include <erebos/state.h>
+#include <erebos/storage.h>
+
+#include <optional>
+#include <mutex>
+
+namespace erebos {
+
+class SyncService : public Service
+{
+public:
+ SyncService();
+ virtual ~SyncService();
+
+ UUID uuid() const override;
+ void handle(Context &) override;
+
+ void serverStarted(const class Server &) override;
+
+private:
+ void peerWatcher(size_t, const class Peer *);
+ void localStateWatcher(const Head<LocalState> &);
+
+ const class Server * server;
+ std::mutex headMutex;
+ std::optional<WatchedHead<LocalState>> watchedHead;
+};
+
+}