forked from oscarlab/Be-Tree
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbacking_store.hpp
More file actions
32 lines (26 loc) · 767 Bytes
/
backing_store.hpp
File metadata and controls
32 lines (26 loc) · 767 Bytes
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
// Generic interface to the disk. Used by swap_space to store
// objects.
#ifndef BACKING_STORE_HPP
#define BACKING_STORE_HPP
#include <cstdint>
#include <cstddef>
#include <iostream>
class backing_store {
public:
virtual uint64_t allocate(size_t n) = 0;
virtual void deallocate(uint64_t id) = 0;
virtual std::iostream * get(uint64_t id) = 0;
virtual void put(std::iostream *ios) = 0;
};
class one_file_per_object_backing_store: public backing_store {
public:
one_file_per_object_backing_store(std::string rt);
uint64_t allocate(size_t n);
void deallocate(uint64_t id);
std::iostream * get(uint64_t id);
void put(std::iostream *ios);
private:
std::string root;
uint64_t nextid;
};
#endif // BACKING_STORE_HPP