Files
scylla/test/lib/reader_concurrency_semaphore.hh
Botond Dénes 8bfe3ca543 query: move max_result_size to query-request.hh
It is currently located in query_class_config.hh, which is named after a
now defunct struct. This arrangement is unintuitive and there is no
upside to it. The main user of max_result_size is query_comand, so
colocate it next to the latter.

Closes #14268
2023-06-20 11:37:50 +02:00

32 lines
856 B
C++

/*
* Copyright (C) 2021-present ScyllaDB
*/
/*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#pragma once
#include "../../reader_concurrency_semaphore.hh"
namespace tests {
// Must be used in a seastar thread.
class reader_concurrency_semaphore_wrapper {
std::unique_ptr<::reader_concurrency_semaphore> _semaphore;
public:
reader_concurrency_semaphore_wrapper(const char* name = nullptr)
: _semaphore(std::make_unique<::reader_concurrency_semaphore>(::reader_concurrency_semaphore::no_limits{}, name ? name : "test")) {
}
~reader_concurrency_semaphore_wrapper() {
_semaphore->stop().get();
}
reader_concurrency_semaphore& semaphore() { return *_semaphore; };
reader_permit make_permit() { return _semaphore->make_tracking_only_permit(nullptr, "test", db::no_timeout, {}); }
};
} // namespace tests