// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once #include #include namespace search::bmcluster { class BucketInfoQueue; /* * Class to track number of pending operations, used as backpressure during * benchmark feeding. */ class PendingTracker { std::atomic _pending; uint32_t _limit; std::unique_ptr _bucket_info_queue; public: PendingTracker(uint32_t limit); ~PendingTracker(); void release() { _pending--; } void retain(); void drain(); void attach_bucket_info_queue(std::atomic& errors); BucketInfoQueue *get_bucket_info_queue() { return _bucket_info_queue.get(); } }; }