The namespace usage in this directory is very inconsistent, with files
and classes scattered in:
* global namespace
* namespace compaction
* namespace sstables
With cases, where all three used in the same file. This code used to
live in sstables/ and some of it still retains namespace sstables as a
heritage of that time. The mismatch between the dir (future module) and
the namespace used is confusing, so finish the migration and move all
code in compaction/ to namespace compaction too.
This patch, although large, is mechanic and only the following kind of
changes are made:
* replace namespace sstable {} with namespace compaction {}
* add namespace compaction {}
* drop/add sstables::
* drop/add compaction::
* move around forward-declarations so they are in the correct namespace
context
This refactoring revealed some awkward leftover coupling between
sstables and compaction, in sstables/sstable_set.cc, where the
make_sstable_set() methods of compaction strategies are implemented.
95 lines
3.9 KiB
C++
95 lines
3.9 KiB
C++
/*
|
|
* Copyright (C) 2015-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <seastar/core/sharded.hh>
|
|
#include <seastar/json/json_elements.hh>
|
|
#include "api/api_init.hh"
|
|
#include "db/data_listeners.hh"
|
|
#include "compaction/compaction_descriptor.hh"
|
|
#include "gms/gossip_address_map.hh"
|
|
|
|
namespace cql_transport { class controller; }
|
|
namespace db {
|
|
class snapshot_ctl;
|
|
namespace view {
|
|
class view_builder;
|
|
}
|
|
class system_keyspace;
|
|
}
|
|
namespace netw { class messaging_service; }
|
|
class repair_service;
|
|
class sstables_loader;
|
|
|
|
namespace gms {
|
|
|
|
class gossiper;
|
|
|
|
}
|
|
|
|
namespace api {
|
|
|
|
// verify that the keyspace is found, otherwise a bad_param_exception exception is thrown
|
|
// containing the description of the respective keyspace error.
|
|
sstring validate_keyspace(const http_context& ctx, sstring ks_name);
|
|
|
|
// verify that the keyspace parameter is found, otherwise a bad_param_exception exception is thrown
|
|
// containing the description of the respective keyspace error.
|
|
sstring validate_keyspace(const http_context& ctx, const std::unique_ptr<http::request>& req);
|
|
|
|
// verify that the keyspace:table is found, otherwise a bad_param_exception exception is thrown
|
|
// returns the table_id of the table if found
|
|
table_id validate_table(const replica::database& db, sstring ks_name, sstring table_name);
|
|
|
|
// splits a request parameter assumed to hold a comma-separated list of table names
|
|
// verify that the tables are found, otherwise a bad_param_exception exception is thrown
|
|
// containing the description of the respective no_such_column_family error.
|
|
// Returns a vector of all table infos given by the parameter, or
|
|
// if the parameter is not found or is empty, returns a list of all table infos in the keyspace.
|
|
|
|
std::vector<table_info> parse_table_infos(const sstring& ks_name, const http_context& ctx, sstring value);
|
|
|
|
std::pair<sstring, std::vector<table_info>> parse_table_infos(const http_context& ctx, const http::request& req, sstring cf_param_name = "cf");
|
|
|
|
struct scrub_info {
|
|
compaction::compaction_type_options::scrub opts;
|
|
sstring keyspace;
|
|
std::vector<sstring> column_families;
|
|
sstring snapshot_tag;
|
|
};
|
|
|
|
scrub_info parse_scrub_options(const http_context& ctx, std::unique_ptr<http::request> req);
|
|
|
|
void set_storage_service(http_context& ctx, httpd::routes& r, sharded<service::storage_service>& ss, service::raft_group0_client&);
|
|
void unset_storage_service(http_context& ctx, httpd::routes& r);
|
|
void set_sstables_loader(http_context& ctx, httpd::routes& r, sharded<sstables_loader>& sst_loader);
|
|
void unset_sstables_loader(http_context& ctx, httpd::routes& r);
|
|
void set_view_builder(http_context& ctx, httpd::routes& r, sharded<db::view::view_builder>& vb, sharded<gms::gossiper>& g);
|
|
void unset_view_builder(http_context& ctx, httpd::routes& r);
|
|
void set_repair(http_context& ctx, httpd::routes& r, sharded<repair_service>& repair, sharded<gms::gossip_address_map>& am);
|
|
void unset_repair(http_context& ctx, httpd::routes& r);
|
|
void set_transport_controller(http_context& ctx, httpd::routes& r, cql_transport::controller& ctl);
|
|
void unset_transport_controller(http_context& ctx, httpd::routes& r);
|
|
void set_thrift_controller(http_context& ctx, httpd::routes& r);
|
|
void unset_thrift_controller(http_context& ctx, httpd::routes& r);
|
|
void set_snapshot(http_context& ctx, httpd::routes& r, sharded<db::snapshot_ctl>& snap_ctl);
|
|
void unset_snapshot(http_context& ctx, httpd::routes& r);
|
|
void set_load_meter(http_context& ctx, httpd::routes& r, service::load_meter& lm);
|
|
void unset_load_meter(http_context& ctx, httpd::routes& r);
|
|
seastar::future<json::json_return_type> run_toppartitions_query(db::toppartitions_query& q, bool legacy_request = false);
|
|
|
|
// converts string value of boolean parameter into bool
|
|
// maps (case insensitively)
|
|
// "true", "yes" and "1" into true
|
|
// "false", "no" and "0" into false
|
|
// otherwise throws runtime_error
|
|
bool validate_bool_x(const sstring& param, bool default_value);
|
|
|
|
} // namespace api
|