Skip to content

Instantly share code, notes, and snippets.

@yhirose
Created December 27, 2020 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yhirose/466445794e3fc6dafa5d6534a8b3226d to your computer and use it in GitHub Desktop.
Save yhirose/466445794e3fc6dafa5d6534a8b3226d to your computer and use it in GitHub Desktop.
RocksDB
#include <rocksdb/db.h>
class RocksDB {
public:
~RocksDB() { delete db_; }
rocksdb::Status open(const rocksdb::Options& options, std::string_view path) {
assert(!db_);
return rocksdb::DB::Open(options, std::string(path), &db_);
}
rocksdb::DB& db() { return *db_; }
private:
rocksdb::DB* db_ = nullptr;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment