提交 36458f35 编写于 作者: L liuqi

KVStorage Find api return const vector pointer.

上级 847b931a
...@@ -104,7 +104,6 @@ void FileStorage::Load() { ...@@ -104,7 +104,6 @@ void FileStorage::Load() {
if (res != 0) { if (res != 0) {
LOG(WARNING) << "munmap file " << file_path_ LOG(WARNING) << "munmap file " << file_path_
<< " failed, error code: " << errno; << " failed, error code: " << errno;
return;
} }
res = close(fd); res = close(fd);
if (res != 0) { if (res != 0) {
...@@ -119,7 +118,7 @@ bool FileStorage::Insert(const std::string &key, ...@@ -119,7 +118,7 @@ bool FileStorage::Insert(const std::string &key,
return true; return true;
} }
std::vector<unsigned char> *FileStorage::Find(const std::string &key) { const std::vector<unsigned char> *FileStorage::Find(const std::string &key) {
auto iter = data_.find(key); auto iter = data_.find(key);
if (iter == data_.end()) return nullptr; if (iter == data_.end()) return nullptr;
......
...@@ -21,7 +21,7 @@ class FileStorage : public KVStorage { ...@@ -21,7 +21,7 @@ class FileStorage : public KVStorage {
void Load() override; void Load() override;
bool Insert(const std::string &key, bool Insert(const std::string &key,
const std::vector<unsigned char> &value) override; const std::vector<unsigned char> &value) override;
std::vector<unsigned char> *Find(const std::string &key) override; const std::vector<unsigned char> *Find(const std::string &key) override;
void Flush() override; void Flush() override;
private: private:
......
...@@ -36,7 +36,7 @@ class KVStorage { ...@@ -36,7 +36,7 @@ class KVStorage {
virtual void Load() = 0; virtual void Load() = 0;
virtual bool Insert(const std::string &key, virtual bool Insert(const std::string &key,
const std::vector<unsigned char> &value) = 0; const std::vector<unsigned char> &value) = 0;
virtual std::vector<unsigned char> *Find(const std::string &key) = 0; virtual const std::vector<unsigned char> *Find(const std::string &key) = 0;
virtual void Flush() = 0; virtual void Flush() = 0;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册