From 5c4b17b2c5ae15bfcb92447151863c4ad67f40fa Mon Sep 17 00:00:00 2001 From: Patrick Venture Date: Thu, 4 Oct 2018 10:32:22 -0700 Subject: new command: BmcBlobWriteMeta Implement new command BmcBlobWriteMeta. Change-Id: I2e148f4bde4ef5d24db7e30bb02bdde024d9166a Signed-off-by: Patrick Venture --- blobs-ipmid/blobs.hpp | 11 +++++++++++ blobs-ipmid/manager.hpp | 14 ++++++++++++++ blobs-ipmid/test/blob_mock.hpp | 2 ++ blobs-ipmid/test/manager_mock.hpp | 2 ++ 4 files changed, 29 insertions(+) (limited to 'blobs-ipmid') diff --git a/blobs-ipmid/blobs.hpp b/blobs-ipmid/blobs.hpp index b6672b7..0014fd4 100644 --- a/blobs-ipmid/blobs.hpp +++ b/blobs-ipmid/blobs.hpp @@ -105,6 +105,17 @@ class GenericBlobInterface virtual bool write(uint16_t session, uint32_t offset, const std::vector& data) = 0; + /** + * Attempt to write metadata to a blob. + * + * @param[in] session - the session id. + * @param[in] offset - offset into the blob. + * @param[in] data - the data to write. + * @return bool - was able to write. + */ + virtual bool writeMeta(uint16_t session, uint32_t offset, + const std::vector& data) = 0; + /** * Attempt to commit to a blob. * diff --git a/blobs-ipmid/manager.hpp b/blobs-ipmid/manager.hpp index 884271c..d7282e6 100644 --- a/blobs-ipmid/manager.hpp +++ b/blobs-ipmid/manager.hpp @@ -56,6 +56,9 @@ class ManagerInterface const std::vector& data) = 0; virtual bool deleteBlob(const std::string& path) = 0; + + virtual bool writeMeta(uint16_t session, uint32_t offset, + const std::vector& data) = 0; }; /** @@ -191,6 +194,17 @@ class BlobManager : public ManagerInterface */ bool deleteBlob(const std::string& path) override; + /** + * Attempt to write Metadata to a blob. + * + * @param[in] session - the session for this command. + * @param[in] offset - the offset into the blob to write. + * @param[in] data - the bytes to write to the blob. + * @return bool - true if the write succeeded. + */ + bool writeMeta(uint16_t session, uint32_t offset, + const std::vector& data) override; + /** * Attempts to return a valid unique session id. * diff --git a/blobs-ipmid/test/blob_mock.hpp b/blobs-ipmid/test/blob_mock.hpp index 3396048..b70d3d1 100644 --- a/blobs-ipmid/test/blob_mock.hpp +++ b/blobs-ipmid/test/blob_mock.hpp @@ -19,6 +19,8 @@ class BlobMock : public GenericBlobInterface MOCK_METHOD3(open, bool(uint16_t, uint16_t, const std::string&)); MOCK_METHOD3(read, std::vector(uint16_t, uint32_t, uint32_t)); MOCK_METHOD3(write, bool(uint16_t, uint32_t, const std::vector&)); + MOCK_METHOD3(writeMeta, + bool(uint16_t, uint32_t, const std::vector&)); MOCK_METHOD2(commit, bool(uint16_t, const std::vector&)); MOCK_METHOD1(close, bool(uint16_t)); MOCK_METHOD2(stat, bool(uint16_t, struct BlobMeta*)); diff --git a/blobs-ipmid/test/manager_mock.hpp b/blobs-ipmid/test/manager_mock.hpp index a4714f8..00eeb6b 100644 --- a/blobs-ipmid/test/manager_mock.hpp +++ b/blobs-ipmid/test/manager_mock.hpp @@ -26,6 +26,8 @@ class ManagerMock : public ManagerInterface MOCK_METHOD3(read, std::vector(uint16_t, uint32_t, uint32_t)); MOCK_METHOD3(write, bool(uint16_t, uint32_t, const std::vector&)); MOCK_METHOD1(deleteBlob, bool(const std::string&)); + MOCK_METHOD3(writeMeta, + bool(uint16_t, uint32_t, const std::vector&)); }; /* -- cgit v1.2.3