MCPcopy Create free account
hub / github.com/ceph/ceph / dequeue_by_pred

Method dequeue_by_pred

src/common/not_before_queue.h:198–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196 /// Dequeue 1st eligible item that satisfies pred, std::nullopt if none
197 template <typename PRED>
198 std::optional<V> dequeue_by_pred(const PRED& pred) {
199 auto iter = std::find_if(
200 eligible_queue.begin(), eligible_queue.end(),
201 [&pred](const auto &i) { return pred(i.v); });
202
203 if (iter == eligible_queue.end()) {
204 return std::nullopt;
205 }
206
207 assert(iter->status == status_t::ELIGIBLE);
208 eligible_queue.erase(typename eligible_queue_t::const_iterator(iter));
209 iter->status = status_t::INVALID;
210
211 std::optional<V> ret(iter->v);
212 removal_registry.erase_and_dispose(
213 removal_registry_t::s_iterator_to(std::as_const(*iter)),
214 removal_registry_disposer_t{});
215 return ret;
216 }
217
218 /**
219 * advance_time

Callers 2

TEST_FFunction · 0.80
pop_ready_entryMethod · 0.80

Calls 5

assertFunction · 0.85
const_iteratorClass · 0.70
beginMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by 1

TEST_FFunction · 0.64