MCPcopy Create free account
hub / github.com/Tencent/phxqueue / Init

Method Init

phxqueue/lock/lockdb.cpp:93–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93comm::RetCode LockDb::Init(const LockDb::Type type, const string &leveldb_file) {
94 type_ = type;
95
96 if (Type::MAP == type_) {
97 } else if (Type::LEVELDB == type_) {
98 leveldb::Options options;
99 options.create_if_missing = true;
100 // raise an error as soon as it detects an internal corruption
101 options.paranoid_checks = leveldb_checks_;
102 leveldb::Status status(leveldb::DB::Open(options, leveldb_file, &leveldb_));
103 if (!status.ok()) {
104 QLErr("open \"%s\" err \"%s\"", leveldb_file.c_str(), status.ToString().c_str());
105
106 return comm::RetCode::RET_ERR_LEVELDB;
107 }
108 } else {
109 return comm::RetCode::RET_ERR_NO_IMPL;
110 }
111
112 return comm::RetCode::RET_OK;
113}
114
115comm::RetCode LockDb::Dispose() {
116 if (Type::MAP == type_) {

Callers

nothing calls this directly

Calls 1

ToStringMethod · 0.80

Tested by

no test coverage detected