Implement commit
The commit operation will serialize the binarystore protobuf and write
it to the designated sysfile location, with its size stored followed by
actual data.
Signed-off-by: Kun Yi <kunyi@google.com>
Change-Id: Idc16f410d3a1585daaddda58a3665d92a898f5c7
diff --git a/handler.cpp b/handler.cpp
index e0a343a..fbfaf47 100644
--- a/handler.cpp
+++ b/handler.cpp
@@ -151,8 +151,13 @@
bool BinaryStoreBlobHandler::commit(uint16_t session,
const std::vector<uint8_t>& data)
{
- // TODO: implement
- return false;
+ auto it = sessions_.find(session);
+ if (it == sessions_.end())
+ {
+ return false;
+ }
+
+ return it->second->commit();
}
bool BinaryStoreBlobHandler::close(uint16_t session)