Commit 7ac1933a authored by LiXiaoyu's avatar LiXiaoyu

gh

parent bfb86f6f
...@@ -18,7 +18,7 @@ kvImplLeveldb::init() { ...@@ -18,7 +18,7 @@ kvImplLeveldb::init() {
//auto db = std::make_unique<leveldb::DB>(); //auto db = std::make_unique<leveldb::DB>();
options.create_if_missing = true; options.create_if_missing = true;
leveldb::Status status = leveldb::DB::Open(options, dir.c_str(), &db); auto status = leveldb::DB::Open(options, dir.c_str(), &db);
if(!status.ok()) { if(!status.ok()) {
//todo //todo
//LOG_ERR("db %s open failed", dir.c_str()); //LOG_ERR("db %s open failed", dir.c_str());
...@@ -34,7 +34,7 @@ bool ...@@ -34,7 +34,7 @@ bool
kvImplLeveldb::get(const vector<char> &key, vector<char> &value) { kvImplLeveldb::get(const vector<char> &key, vector<char> &value) {
myValue v(&value); myValue v(&value);
leveldb::Status s = _db->Get(leveldb::ReadOptions(), leveldb::Slice(key.data(), key.size()), &v); auto s = _db->Get(leveldb::ReadOptions(), leveldb::Slice(key.data(), key.size()), &v);
if(! s.ok()) { if(! s.ok()) {
//std::cerr << s.ToString() << '\n'; //std::cerr << s.ToString() << '\n';
//LOG_INFO //LOG_INFO
...@@ -45,7 +45,7 @@ kvImplLeveldb::get(const vector<char> &key, vector<char> &value) { ...@@ -45,7 +45,7 @@ kvImplLeveldb::get(const vector<char> &key, vector<char> &value) {
bool bool
kvImplLeveldb::set(const vector<char> &key, const vector<char> &value) { kvImplLeveldb::set(const vector<char> &key, const vector<char> &value) {
leveldb::Status s = _db->Put(leveldb::WriteOptions(), leveldb::Slice(key.data(), key.size()), auto s = _db->Put(leveldb::WriteOptions(), leveldb::Slice(key.data(), key.size()),
leveldb::Slice(value.data(), value.size())); leveldb::Slice(value.data(), value.size()));
return s.ok(); return s.ok();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment