MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / removeOldestBin

Method removeOldestBin

extensions/libarchive/BinFiles.cpp:175–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175void BinManager::removeOldestBin() {
176 std::lock_guard < std::mutex > lock(mutex_);
177 uint64_t olddate = ULLONG_MAX;
178 std::unique_ptr < std::deque<std::unique_ptr<Bin>>>* oldqueue;
179 for (std::map<std::string, std::unique_ptr<std::deque<std::unique_ptr<Bin>>>>::iterator it=groupBinMap_.begin(); it !=groupBinMap_.end(); ++it) {
180 std::unique_ptr < std::deque<std::unique_ptr<Bin>>>&queue = it->second;
181 if (!queue->empty()) {
182 std::unique_ptr<Bin> &bin = queue->front();
183 if (bin->getBinAge() < olddate) {
184 olddate = bin->getBinAge();
185 oldqueue = &queue;
186 }
187 }
188 }
189 if (olddate != ULLONG_MAX) {
190 std::unique_ptr<Bin> &remove = (*oldqueue)->front();
191 std::string group = remove->getGroupId();
192 readyBin_.push_back(std::move(remove));
193 (*oldqueue)->pop_front();
194 binCount_--;
195 logger_->log_debug("BinManager move bin %s to ready bins for group %s", readyBin_.back()->getUUIDStr(), readyBin_.back()->getGroupId());
196 if ((*oldqueue)->empty()) {
197 groupBinMap_.erase(group);
198 }
199 }
200 logger_->log_debug("BinManager groupBinMap size %d", groupBinMap_.size());
201}
202
203void BinManager::getReadyBin(std::deque<std::unique_ptr<Bin>> &retBins) {
204 std::lock_guard < std::mutex > lock(mutex_);

Callers 1

onTriggerMethod · 0.80

Calls 9

getBinAgeMethod · 0.80
log_debugMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
getGroupIdMethod · 0.45
getUUIDStrMethod · 0.45
eraseMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected