Implement stat
Implement both session based and path based stat, and properly
set commit state to dirty when new content has not been committed.
Resolves: openbmc/phosphor-ipmi-blobs-binarystore#3
Tested: unit tests pass
Signed-off-by: Kun Yi <kunyi731@gmail.com>
Change-Id: I7c833cf4c7dcb0089db778caa60fc92edceb984e
diff --git a/handler.cpp b/handler.cpp
index 0556633..66500f4 100644
--- a/handler.cpp
+++ b/handler.cpp
@@ -81,8 +81,13 @@
bool BinaryStoreBlobHandler::stat(const std::string& path,
struct BlobMeta* meta)
{
- // TODO: implement
- return false;
+ auto it = stores_.find(internal::getBaseFromId(path));
+ if (it == stores_.end())
+ {
+ return false;
+ }
+
+ return it->second->stat(meta);
}
bool BinaryStoreBlobHandler::open(uint16_t session, uint16_t flags,
@@ -179,8 +184,13 @@
bool BinaryStoreBlobHandler::stat(uint16_t session, struct BlobMeta* meta)
{
- // TODO: implement
- return false;
+ auto it = sessions_.find(session);
+ if (it == sessions_.end())
+ {
+ return false;
+ }
+
+ return it->second->stat(meta);
}
bool BinaryStoreBlobHandler::expire(uint16_t session)