diff --git a/mace/core/file_storage.cc b/mace/core/file_storage.cc index eb48cfed393576141d7c2f6e9fc3ea7f0a51e6e1..d0030d2bd91b470f7bbaaa09a5d3c9ee9fb39ca9 100644 --- a/mace/core/file_storage.cc +++ b/mace/core/file_storage.cc @@ -104,7 +104,6 @@ void FileStorage::Load() { if (res != 0) { LOG(WARNING) << "munmap file " << file_path_ << " failed, error code: " << errno; - return; } res = close(fd); if (res != 0) { @@ -119,7 +118,7 @@ bool FileStorage::Insert(const std::string &key, return true; } -std::vector *FileStorage::Find(const std::string &key) { +const std::vector *FileStorage::Find(const std::string &key) { auto iter = data_.find(key); if (iter == data_.end()) return nullptr; diff --git a/mace/core/file_storage.h b/mace/core/file_storage.h index b1c90b50351f559a0d0a8315256b39fa1eeb6bca..7c777e7edd6c32a6694c92f2d538cceadb06d1c6 100644 --- a/mace/core/file_storage.h +++ b/mace/core/file_storage.h @@ -21,7 +21,7 @@ class FileStorage : public KVStorage { void Load() override; bool Insert(const std::string &key, const std::vector &value) override; - std::vector *Find(const std::string &key) override; + const std::vector *Find(const std::string &key) override; void Flush() override; private: diff --git a/mace/public/mace_runtime.h b/mace/public/mace_runtime.h index 55397701397647318bfefbbb0b2a3a443c502ae7..46500994642b29e16dadacfa2cac3a1c597c9cb8 100644 --- a/mace/public/mace_runtime.h +++ b/mace/public/mace_runtime.h @@ -36,7 +36,7 @@ class KVStorage { virtual void Load() = 0; virtual bool Insert(const std::string &key, const std::vector &value) = 0; - virtual std::vector *Find(const std::string &key) = 0; + virtual const std::vector *Find(const std::string &key) = 0; virtual void Flush() = 0; };