MCPcopy Create free account
hub / github.com/ElementsProject/elements / MaybeScheduleCompaction

Method MaybeScheduleCompaction

src/leveldb/db/db_impl.cc:658–673  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

656}
657
658void DBImpl::MaybeScheduleCompaction() {
659 mutex_.AssertHeld();
660 if (background_compaction_scheduled_) {
661 // Already scheduled
662 } else if (shutting_down_.load(std::memory_order_acquire)) {
663 // DB is being deleted; no more background compactions
664 } else if (!bg_error_.ok()) {
665 // Already got an error; no more changes
666 } else if (imm_ == nullptr && manual_compaction_ == nullptr &&
667 !versions_->NeedsCompaction()) {
668 // No work to be done
669 } else {
670 background_compaction_scheduled_ = true;
671 env_->Schedule(&DBImpl::BGWork, this);
672 }
673}
674
675void DBImpl::BGWork(void* db) {
676 reinterpret_cast<DBImpl*>(db)->BackgroundCall();

Callers 1

OpenMethod · 0.80

Calls 3

NeedsCompactionMethod · 0.80
loadMethod · 0.45
ScheduleMethod · 0.45

Tested by

no test coverage detected