blob: 068db5a0ee9fbb9a0bd3596bd25867dafdd276b3 [file] [log] [blame]
Kun Yi68c81142018-12-18 11:17:14 -08001#pragma once
2
3#include <cstdint>
4#include <string>
5#include <vector>
6
7using std::size_t;
8using std::uint16_t;
9using std::uint32_t;
10using std::uint64_t;
11using std::uint8_t;
12
13namespace binstore
14{
15
16/**
17 * @class BinaryStoreInterface is an abstraction for a storage location.
18 * Each instance would be uniquely identified by a baseId string.
19 */
20class BinaryStoreInterface
21{
22 public:
23 virtual ~BinaryStoreInterface() = default;
24
25 virtual std::string getBaseBlobId() const = 0;
26 virtual std::vector<std::string> getBlobIds() const = 0;
27 virtual bool canHandleBlob(const std::string& blobId) const = 0;
28 virtual bool openOrCreateBlob(const std::string& blobId) = 0;
29 virtual std::vector<uint8_t> read(uint32_t offset,
30 uint32_t requestedSize) = 0;
31 virtual bool write(uint32_t offset, const std::vector<uint8_t>& data) = 0;
32 virtual bool commit() = 0;
33 virtual bool close() = 0;
34 virtual bool stat() = 0;
35};
36
37} // namespace binstore