summaryrefslogtreecommitdiff
path: root/src/state.h
blob: 91dea9468af11b17ba5ab0700c3a65550adb9ce6 (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
35
36
37
38
39
40
#pragma once

#include <erebos/state.h>

#include "pubkey.h"

using std::optional;
using std::shared_ptr;
using std::vector;

namespace erebos {

struct SharedState::Priv
{
	vector<Ref> lookup(UUID) const;

	vector<Stored<struct SharedData>> tip;
};

struct LocalState::Priv
{
	optional<Identity> identity;
	SharedState::Priv shared;
};

struct SharedData
{
	explicit SharedData(vector<Stored<SharedData>> prev,
			UUID type, vector<Ref> value):
		prev(prev), type(type), value(value) {}
	explicit SharedData(const Ref &);
	static SharedData load(const Ref & ref) { return SharedData(ref); }
	Ref store(const Storage &) const;

	vector<Stored<SharedData>> prev;
	UUID type;
	vector<Ref> value;
};

}