mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-22 07:42:16 +00:00
Move `validate_enumerated_option`, `validate_positive_option`, and `validate_factor_option` into shared index option utilities under the `secondary_index::util` namespace. These functions were previously defined as file-local statics in `vector_index.cc` with hardcoded index names in error messages. The shared versions take `index_type_name` as a parameter, allowing each `custom_index` subclass to pass its own name via the virtual `index_type_name()` method at the call site. The options maps use `std::bind_front` to bind config params (supported values, limits), leaving `index_name` as the first unbound argument passed by `check_index_options()`. Add `index_type_name()` as a pure virtual method on `custom_index`. Move the shared utility implementations into `index_option_utils.cc` and update `vector_index.cc` to use them.
27 lines
856 B
C++
27 lines
856 B
C++
/*
|
|
* Copyright 2026-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <string_view>
|
|
#include <vector>
|
|
#include <seastar/core/sstring.hh>
|
|
|
|
namespace secondary_index::util {
|
|
|
|
inline const std::vector<seastar::sstring> boolean_values = {"false", "true"};
|
|
|
|
void validate_enumerated_option(const std::vector<seastar::sstring>& supported_values, std::string_view index_type_name, const seastar::sstring& value_name,
|
|
const seastar::sstring& value);
|
|
|
|
void validate_positive_option(int max, std::string_view index_type_name, const seastar::sstring& value_name, const seastar::sstring& value);
|
|
|
|
void validate_factor_option(float min, float max, std::string_view index_type_name, const seastar::sstring& value_name, const seastar::sstring& value);
|
|
|
|
} // namespace secondary_index::util
|