summaryrefslogtreecommitdiff
path: root/src/storage.h
blob: 2a0ad7e0b606c517418c3d579f365bcdef68e71f (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/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;
};

}