// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "forcecommitcontext.h" #include "forcecommitdonetask.h" #include #include #include namespace proton { ForceCommitContext::ForceCommitContext(vespalib::Executor &executor, IDocumentMetaStore &documentMetaStore, PendingLidTrackerBase::Snapshot lidsToCommit, std::unique_ptr pending_gid_to_lid_changes, std::shared_ptr onDone) : _executor(executor), _task(std::make_unique(documentMetaStore, std::move(pending_gid_to_lid_changes))), _committedDocIdLimit(0u), _docIdLimit(nullptr), _onDone(std::move(onDone)), _lidsToCommit(std::move(lidsToCommit)) { } ForceCommitContext::~ForceCommitContext() { if (_docIdLimit != nullptr) { _docIdLimit->bumpUpLimit(_committedDocIdLimit); } if (!_task->empty()) { vespalib::Executor::Task::UP res = _executor.execute(std::move(_task)); assert(!res); } } void ForceCommitContext::reuseLids(std::vector &&lids) { _task->reuseLids(std::move(lids)); } void ForceCommitContext::holdUnblockShrinkLidSpace() { _task->holdUnblockShrinkLidSpace(); } void ForceCommitContext::registerCommittedDocIdLimit(uint32_t committedDocIdLimit, DocIdLimit *docIdLimit) { _committedDocIdLimit = committedDocIdLimit; _docIdLimit = docIdLimit; } } // namespace proton