forked from scylladb/scylladb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquery_processor.cc
48 lines (38 loc) · 1.18 KB
/
query_processor.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* 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"
namespace redis {
distributed<query_processor> _the_query_processor;
query_processor::query_processor(service::storage_proxy& proxy, data_dictionary::database db)
: _proxy(proxy)
, _db(db)
{
}
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);
});
});
}
}