splits objects into separate headers
The binarystore.(c|h)pp now contains BinaryStore, while
binarystore_interface contains BinaryStoreInterface.
The sys_file.hpp contains SysFile, while sys_file_impl.(c|h)pp contains
SysFileImpl.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Ic65792a59809e05e186f7710a27ad6bd0e298c94
diff --git a/binarystore.hpp b/binarystore.hpp
index 9f95539..8185a8a 100644
--- a/binarystore.hpp
+++ b/binarystore.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include "binarystore_interface.hpp"
#include "sys_file.hpp"
#include <unistd.h>
@@ -22,80 +23,6 @@
{
/**
- * @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;
-
- /**
- * @returns baseId string of the storage.
- */
- virtual std::string getBaseBlobId() const = 0;
-
- /**
- * @returns List of all open blob IDs, plus the base.
- */
- virtual std::vector<std::string> getBlobIds() const = 0;
-
- /**
- * Opens a blob given its name. If there is no one, create one.
- * @param blobId: The blob id to operate on.
- * @param flags: Either read flag or r/w flag has to be specified.
- * @returns True if open/create successfully.
- */
- virtual bool openOrCreateBlob(const std::string& blobId,
- uint16_t flags) = 0;
-
- /**
- * Deletes a blob given its name. If there is no one,
- * @param blobId: The blob id to operate on.
- * @returns True if deleted.
- */
- virtual bool deleteBlob(const std::string& blobId) = 0;
-
- /**
- * Reads data from the currently opened blob.
- * @param offset: offset into the blob to read
- * @param requestedSize: how many bytes to read
- * @returns Bytes able to read. Returns empty if nothing can be read or
- * if there is no open blob.
- */
- virtual std::vector<uint8_t> read(uint32_t offset,
- uint32_t requestedSize) = 0;
-
- /**
- * Writes data to the currently openend blob.
- * @param offset: offset into the blob to write
- * @param data: bytes to write
- * @returns True if able to write the entire data successfully
- */
- virtual bool write(uint32_t offset, const std::vector<uint8_t>& data) = 0;
-
- /**
- * Commits data to the persistent storage specified during blob init.
- * @returns True if able to write data to sysfile successfully
- */
- virtual bool commit() = 0;
-
- /**
- * Closes blob, which prevents further modifications. Uncommitted data will
- * be lost.
- * @returns True if able to close the blob successfully
- */
- virtual bool close() = 0;
-
- /**
- * Returns blob stat flags.
- * @param meta: output stat flags.
- * @returns True if able to get the stat flags and write to *meta
- */
- virtual bool stat(blobs::BlobMeta* meta) = 0;
-};
-
-/**
* @class BinaryStore instantiates a concrete implementation of
* BinaryStoreInterface. The dependency on file is injected through its
* constructor.