From 361891f25ca735fd85db64a14823cc55b8a0619a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 26 Oct 2019 22:19:56 +0200 Subject: Basic object encoding and storage --- src/storage.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/storage.h (limited to 'src/storage.h') 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 + +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> loadBytes(const Digest &) const; + void storeBytes(const Digest &, const vector &) const; +}; + +struct Ref::Priv +{ + Storage storage; + Digest digest; + + shared_future object; +}; + +} -- cgit v1.2.3