From 08c094ea14f259ecf0c356e6243cb47ee96ce292 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Fri, 18 Oct 2024 22:19:43 +0800 Subject: [PATCH] Add flushGop for RingBuffer --- src/Util/RingBuffer.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Util/RingBuffer.h b/src/Util/RingBuffer.h index 9ad6fb9a..f1c12038 100644 --- a/src/Util/RingBuffer.h +++ b/src/Util/RingBuffer.h @@ -433,6 +433,13 @@ class RingBuffer : public std::enable_shared_from_this> { } } + void flushGop(std::function cb) { + LOCK_GUARD(_mtx_map); + _storage->getCache().for_each([&](const List> &lst) { + lst.for_each([&](const std::pair &pr) { cb(pr.second); }); + }); + } + void getInfoList(const onGetInfoCB &cb, const typename RingReaderDispatcher::onChangeInfoCB &on_change = nullptr) { if (!cb) { return;