Files
scylladb/redis/query_processor.cc
Benny Halevy aff6017e83 redis: query_processor: use named gate
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2025-04-12 11:28:49 +03:00

51 lines
1.3 KiB
C++

/*
* Copyright (C) 2019 pengjian.uestc @ gmail.com
*/
/*
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#include "redis/query_processor.hh"
#include "redis/request.hh"
#include "redis/reply.hh"
#include "redis/command_factory.hh"
#include "redis/options.hh"
#include "service_permit.hh"
#include <seastar/core/distributed.hh>
namespace redis {
distributed<query_processor> _the_query_processor;
query_processor::query_processor(service::storage_proxy& proxy, data_dictionary::database db)
: _proxy(proxy)
, _db(db)
, _pending_command_gate("redis::query_processor::pending_command")
{
}
query_processor::~query_processor() {
}
future<> query_processor::start() {
return make_ready_future<>();
}
future<> query_processor::stop() {
// wait for all running command finished.
return _pending_command_gate.close().then([] {
return make_ready_future<>();
});
}
future<redis_message> query_processor::process(request&& req, redis::redis_options& opts, service_permit permit) {
return do_with(std::move(req), [this, &opts, permit] (auto& req) {
return with_gate(_pending_command_gate, [this, &req, &opts, permit] () mutable {
return command_factory::create_execute(_proxy, req, opts, permit);
});
});
}
}