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

Method Delete

phxqueue/lock/lockdb.cpp:444–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442}
443
444comm::RetCode LockDb::Delete(const string &k, const bool sync) {
445 if (0 >= k.size()) {
446 QLErr("key \"%s\" invalid", k.c_str());
447
448 return comm::RetCode::RET_ERR_KEY;
449 }
450
451 if (Type::MAP == type_) {
452 map_.erase(k);
453 QLVerb("key \"%s\"", k.c_str());
454 } else if (Type::LEVELDB == type_) {
455 leveldb::WriteOptions write_options;
456 write_options.sync = sync;
457 leveldb::Status status(leveldb_->Delete(write_options, k));
458 if (!status.ok()) {
459 QLErr("%s", status.ToString().c_str());
460
461 return comm::RetCode::RET_ERR_LEVELDB;
462 }
463 QLVerb("key \"%s\"", k.c_str());
464 } else {
465 return comm::RetCode::RET_ERR_NO_IMPL;
466 }
467
468 return comm::RetCode::RET_OK;
469}
470
471void LockDb::SeekToFirst() {
472 if (Type::MAP == type_) {

Callers 2

AcquireLockMethod · 0.80
AcquireLockMethod · 0.80

Calls 1

ToStringMethod · 0.80

Tested by

no test coverage detected