summaryrefslogtreecommitdiff
path: root/include/erebos/sync.h
blob: dad4e0ef1d43d76210cacc78b7cecc6b66d7346b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once

#include <erebos/service.h>
#include <erebos/state.h>
#include <erebos/storage.h>

#include <optional>
#include <mutex>
#include <vector>

namespace erebos {

using std::vector;

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 vector<Ref> &);

	const class Server * server;
	std::optional<Watched<vector<Ref>>> watchedLocal;
};

}