summaryrefslogtreecommitdiff
path: root/include/erebos/sync.h
diff options
context:
space:
mode:
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;
+};
+
+}