Today, any source file or header file that wants to use the tri_mode_restriction type needs to include db/config.hh, which is a large and frequently-changing header file. In this patch we split this type into a separate header file, db/tri_mode_restriction.hh, and avoid a few unnecessary inclusions of db/config.hh. However, a few source files now need to explicitly include db/config.hh, after its transitive inclusion is gone. Note that the overwhelmingly common inclusion of db/config.hh continues to be a problem after this patch - 128 source files include it directly. So this patch is just the first step in long journey. Signed-off-by: Nadav Har'El <nyh@scylladb.com> Closes scylladb/scylladb#25692
32 lines
810 B
C++
32 lines
810 B
C++
/*
|
|
* Copyright (C) 2021-present ScyllaDB
|
|
*
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <seastar/core/sstring.hh>
|
|
|
|
#include "seastarx.hh"
|
|
#include "utils/enum_option.hh"
|
|
|
|
namespace db {
|
|
|
|
/// A restriction that can be in three modes: true (the operation is
|
|
/// restricted), false (the operation is unrestricted), or warn (the
|
|
/// operation is unrestricted but produces some warning (in the response,
|
|
/// log and/or metric) when the operation would have been forbidden in
|
|
/// "true" mode.
|
|
struct tri_mode_restriction_t {
|
|
enum class mode { FALSE, TRUE, WARN };
|
|
static std::unordered_map<sstring, mode> map(); // for enum_option<>
|
|
};
|
|
using tri_mode_restriction = enum_option<tri_mode_restriction_t>;
|
|
|
|
} // namespace db
|