binarystore: Implement open/close
Opening a blob will either have read flag for read only access, or
read|write flag for read/write access. When opening a supported path if
the blob doesn't exist yet, the handler will create an empty blob.
Signed-off-by: Kun Yi <kunyi@google.com>
Change-Id: I3d2c5b761227b77cda8bbc6fa66515e9921c066c
diff --git a/binarystore.hpp b/binarystore.hpp
index 7020cff..4091fd4 100644
--- a/binarystore.hpp
+++ b/binarystore.hpp
@@ -98,7 +98,7 @@
BinaryStore(const std::string& baseBlobId, int fd, uint32_t offset,
uint32_t maxSize) :
baseBlobId_(baseBlobId),
- fd_(fd), offset_(offset), maxSize_(maxSize)
+ fd_(fd), offset_(offset), maxSize_(maxSize), currentBlob_(nullptr)
{
}
@@ -141,6 +141,7 @@
uint32_t maxSize_;
binaryblobproto::BinaryBlobBase blob_;
binaryblobproto::BinaryBlob* currentBlob_;
+ bool writable_ = false;
};
} // namespace binstore