Status Put(const std::vector<std::pair<std::string, std::string>>& writes) { leveldb::WriteBatch batch; for (auto kv : writes) { batch.Put(kv.first, kv.second); } leveldb::Status s = db->Write(leveldb::WriteOptions(), &batch); if (s.ok()) { return Status::OK(); } return Status::NotFound(); }
Status Put(const std::vector<std::pair<unsigned int, std::string>>& writes) { leveldb::WriteBatch batch; for (auto kv : writes) { std::string keystr; ZUtil::PutVarint64(keystr, kv.first); batch.Put(keystr, kv.second); } leveldb::Status s = db->Write(leveldb::WriteOptions(), &batch); if (s.ok()) { return Status::OK(); } return Status::NotFound(); }