Add class interface BinaryStore for storage abstraction

Represent each storage location as a separate class instance. Add an
interface BinaryStore for this purpose, and add basic unit tests
using a mock.

Signed-off-by: Kun Yi <kunyi@google.com>
Change-Id: I67a140280985db567a4f31d0fe5439105b0a47f9
diff --git a/binarystore.hpp b/binarystore.hpp
new file mode 100644
index 0000000..068db5a
--- /dev/null
+++ b/binarystore.hpp
@@ -0,0 +1,37 @@
+#pragma once
+
+#include <cstdint>
+#include <string>
+#include <vector>
+
+using std::size_t;
+using std::uint16_t;
+using std::uint32_t;
+using std::uint64_t;
+using std::uint8_t;
+
+namespace binstore
+{
+
+/**
+ * @class BinaryStoreInterface is an abstraction for a storage location.
+ *        Each instance would be uniquely identified by a baseId string.
+ */
+class BinaryStoreInterface
+{
+  public:
+    virtual ~BinaryStoreInterface() = default;
+
+    virtual std::string getBaseBlobId() const = 0;
+    virtual std::vector<std::string> getBlobIds() const = 0;
+    virtual bool canHandleBlob(const std::string& blobId) const = 0;
+    virtual bool openOrCreateBlob(const std::string& blobId) = 0;
+    virtual std::vector<uint8_t> read(uint32_t offset,
+                                      uint32_t requestedSize) = 0;
+    virtual bool write(uint32_t offset, const std::vector<uint8_t>& data) = 0;
+    virtual bool commit() = 0;
+    virtual bool close() = 0;
+    virtual bool stat() = 0;
+};
+
+} // namespace binstore