maxSize parameter to binarystore unused
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Iab6d3b5de6c48e34461cc0f88083e761542f3ae5
diff --git a/binarystore.cpp b/binarystore.cpp
index 5b0e299..1307c3a 100644
--- a/binarystore.cpp
+++ b/binarystore.cpp
@@ -29,8 +29,7 @@
std::unique_ptr<BinaryStoreInterface>
BinaryStore::createFromConfig(const std::string& baseBlobId,
- std::unique_ptr<SysFile> file,
- uint32_t maxSize)
+ std::unique_ptr<SysFile> file)
{
if (baseBlobId.empty() || !file)
{
@@ -39,8 +38,7 @@
return nullptr;
}
- auto store =
- std::make_unique<BinaryStore>(baseBlobId, std::move(file), maxSize);
+ auto store = std::make_unique<BinaryStore>(baseBlobId, std::move(file));
if (!store->loadSerializedData())
{
diff --git a/binarystore.hpp b/binarystore.hpp
index 8185a8a..c86934e 100644
--- a/binarystore.hpp
+++ b/binarystore.hpp
@@ -42,10 +42,8 @@
};
BinaryStore() = delete;
- BinaryStore(const std::string& baseBlobId, std::unique_ptr<SysFile> file,
- uint32_t maxSize) :
- baseBlobId_(baseBlobId),
- file_(std::move(file)), maxSize_(maxSize)
+ BinaryStore(const std::string& baseBlobId, std::unique_ptr<SysFile> file) :
+ baseBlobId_(baseBlobId), file_(std::move(file))
{
blob_.set_blob_base_id(baseBlobId_);
}
@@ -71,14 +69,12 @@
* Helper factory method to create a BinaryStore instance
* @param baseBlobId: base id for the created instance
* @param sysFile: system file object for storing binary
- * @param maxSize: max size in bytes that this BinaryStore can expand to.
- * Writing data more than allowed size will return failure.
* @returns unique_ptr to constructed BinaryStore. Caller should take
* ownership of the instance.
*/
static std::unique_ptr<BinaryStoreInterface>
createFromConfig(const std::string& baseBlobId,
- std::unique_ptr<SysFile> file, uint32_t maxSize);
+ std::unique_ptr<SysFile> file);
private:
/* Load the serialized data from sysfile if commit state is dirty.
@@ -90,7 +86,6 @@
binaryblobproto::BinaryBlob* currentBlob_ = nullptr;
bool writable_ = false;
std::unique_ptr<SysFile> file_ = nullptr;
- uint32_t maxSize_;
CommitState commitState_ = CommitState::Dirty;
};
diff --git a/binarystore_mock.hpp b/binarystore_mock.hpp
index 34f14b8..8f60ebe 100644
--- a/binarystore_mock.hpp
+++ b/binarystore_mock.hpp
@@ -19,8 +19,8 @@
{
public:
MockBinaryStore(const std::string& baseBlobId,
- std::unique_ptr<SysFile> file, uint32_t maxSize) :
- real_store_(baseBlobId, std::move(file), maxSize)
+ std::unique_ptr<SysFile> file) :
+ real_store_(baseBlobId, std::move(file))
{
// Implemented calls in BinaryStore will be directed to the real object.
ON_CALL(*this, getBaseBlobId)
diff --git a/main.cpp b/main.cpp
index ac12fb9..061fc4c 100644
--- a/main.cpp
+++ b/main.cpp
@@ -71,7 +71,7 @@
config.offsetBytes);
handler->addNewBinaryStore(binstore::BinaryStore::createFromConfig(
- config.blobBaseId, std::move(file), config.maxSizeBytes));
+ config.blobBaseId, std::move(file)));
}
return std::move(handler);
diff --git a/test/handler_unittest.cpp b/test/handler_unittest.cpp
index 217b1d6..789eefb 100644
--- a/test/handler_unittest.cpp
+++ b/test/handler_unittest.cpp
@@ -176,7 +176,7 @@
std::vector<std::string> expectedIdList = {basicTestBaseId};
handler.addNewBinaryStore(BinaryStore::createFromConfig(
- basicTestBaseId, std::make_unique<FakeSysFile>(commitData), 0));
+ basicTestBaseId, std::make_unique<FakeSysFile>(commitData)));
EXPECT_FALSE(handler.canHandleBlob(staleBlobId));
EXPECT_EQ(handler.getBlobIds(), expectedIdList);
}
@@ -185,7 +185,7 @@
{
const std::string emptyData;
EXPECT_NO_THROW(handler.addNewBinaryStore(BinaryStore::createFromConfig(
- basicTestBaseId, std::make_unique<FakeSysFile>(emptyData), 0)));
+ basicTestBaseId, std::make_unique<FakeSysFile>(emptyData))));
EXPECT_TRUE(handler.canHandleBlob(basicTestBlobId));
}
@@ -197,8 +197,8 @@
EXPECT_GE(tooLarge, junkDataWithLargeSize.max_size());
EXPECT_NO_THROW(handler.addNewBinaryStore(BinaryStore::createFromConfig(
- basicTestBaseId, std::make_unique<FakeSysFile>(junkDataWithLargeSize),
- 0)));
+ basicTestBaseId,
+ std::make_unique<FakeSysFile>(junkDataWithLargeSize))));
EXPECT_TRUE(handler.canHandleBlob(basicTestBlobId));
}
diff --git a/test/handler_unittest.hpp b/test/handler_unittest.hpp
index 019c7ad..63e14c6 100644
--- a/test/handler_unittest.hpp
+++ b/test/handler_unittest.hpp
@@ -27,7 +27,7 @@
std::unique_ptr<MockBinaryStore> defaultMockStore(const std::string& baseId)
{
return std::make_unique<MockBinaryStore>(
- baseId, std::make_unique<FakeSysFile>(), 0);
+ baseId, std::make_unique<FakeSysFile>());
}
void addDefaultStore(const std::string& baseId)