summaryrefslogtreecommitdiff
path: root/src/storage.h
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2019-10-26 22:19:56 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2019-12-10 21:29:28 +0100
commit361891f25ca735fd85db64a14823cc55b8a0619a (patch)
treed45734fbc123d8dcb26128b314eb4453ecdd154e /src/storage.h
parent1a1b36dea942cd7b18067f3f1220c9ab4f9b4448 (diff)
Basic object encoding and storage
Diffstat (limited to 'src/storage.h')
-rw-r--r--src/storage.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/storage.h b/src/storage.h
new file mode 100644
index 0000000..2a0ad7e
--- /dev/null
+++ b/src/storage.h
@@ -0,0 +1,34 @@
+#pragma once
+
+#include "erebos/storage.h"
+
+#include <future>
+
+namespace fs = std::filesystem;
+
+using std::optional;
+using std::shared_future;
+using std::vector;
+
+namespace erebos {
+
+struct Storage::Priv
+{
+ static constexpr size_t CHUNK = 16384;
+
+ fs::path root;
+
+ fs::path objectPath(const Digest &) const;
+ optional<vector<uint8_t>> loadBytes(const Digest &) const;
+ void storeBytes(const Digest &, const vector<uint8_t> &) const;
+};
+
+struct Ref::Priv
+{
+ Storage storage;
+ Digest digest;
+
+ shared_future<Object> object;
+};
+
+}