ClangBuildAnalyzer reports cql3/cql_statement.hh as being one of the most expensive header files in the project - being included (mostly indirectly) in 129 source files, and costing a total of 844 CPU seconds of compilation. This patch is an attempt, only *partially* successful, to reduce the number of times that cql_statement.hh is included. It succeeds in lowering the number 129 to 99, but not less :-( One of the biggest difficulties in reducing it further is that query_processor.hh includes a lot of templated code, which needs stuff from cql_statement.hh. The solution should be to un-template the functions in query_processor.hh and move them from the header to a source file, but this is beyond the scope of this patch and query_processor.hh appears problematic in other respects as well. Unfortunately the compilation speedup by this patch is negligible (the `du -bc build/dev/**/*.o` metric shows less than 0.01% reduction). Beyond the fact that this patch only removes 30% of the inclusions of this header, it appears that most of the source files that no longer include cql_statement.hh after this patch, included anyway many of the other headers that cql_statement.hh included, so the saving is minimal. Signed-off-by: Nadav Har'El <nyh@scylladb.com> Closes #15212
36 lines
964 B
C++
36 lines
964 B
C++
/*
|
|
* Copyright (C) 2022-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
#include "api/api-doc/authorization_cache.json.hh"
|
|
|
|
#include "api/authorization_cache.hh"
|
|
#include "api/api.hh"
|
|
#include "auth/common.hh"
|
|
#include "auth/service.hh"
|
|
|
|
namespace api {
|
|
using namespace json;
|
|
using namespace seastar::httpd;
|
|
|
|
void set_authorization_cache(http_context& ctx, routes& r, sharded<auth::service> &auth_service) {
|
|
httpd::authorization_cache_json::authorization_cache_reset.set(r, [&auth_service] (std::unique_ptr<http::request> req) -> future<json::json_return_type> {
|
|
co_await auth_service.invoke_on_all([] (auth::service& auth) -> future<> {
|
|
auth.reset_authorization_cache();
|
|
return make_ready_future<>();
|
|
});
|
|
|
|
co_return json_void();
|
|
});
|
|
}
|
|
|
|
void unset_authorization_cache(http_context& ctx, routes& r) {
|
|
httpd::authorization_cache_json::authorization_cache_reset.unset(r);
|
|
}
|
|
|
|
}
|