storage_service: prepare for async gate in REST handlers

Add hold_async_gate() public accessor for use by the REST registration
layer in a followup commit.

Convert run_with_no_api_lock to a coroutine so a followup commit can
hold the async gate across the entire forwarded operation.

No functional changes.
This commit is contained in:
Piotr Smaron
2026-04-22 10:15:09 +02:00
parent cddde464ca
commit 74dd33811e

View File

@@ -794,6 +794,10 @@ private:
public:
int32_t get_exception_count();
auto hold_async_gate() {
return _async_gate.hold();
}
template <typename Func>
auto run_with_api_lock(sstring operation, Func&& func) {
return container().invoke_on(0, [operation = std::move(operation),
@@ -804,8 +808,9 @@ public:
template <typename Func>
auto run_with_no_api_lock(Func&& func) {
return container().invoke_on(0, [func = std::forward<Func>(func)] (storage_service& ss) mutable {
return func(ss);
return container().invoke_on(0, [func = std::forward<Func>(func)] (storage_service& ss) mutable
-> futurize_t<std::invoke_result_t<Func, storage_service&>> {
co_return co_await futurize_invoke(func, ss);
});
}