summaryrefslogtreecommitdiff
path: root/src/state.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/state.h')
-rw-r--r--src/state.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/state.h b/src/state.h
new file mode 100644
index 0000000..397a906
--- /dev/null
+++ b/src/state.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#include <erebos/state.h>
+#include <erebos/identity.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;
+};
+
+}