use super::types::{Domain, Fallback, KeySpec};
pub(super) const TRUE_WORDS: [&str; 3] = ["true", "yes", "1"];
pub(super) const FALSE_WORDS: [&str; 3] = ["false", "no", "0"];
const CHANNEL_COMPRESSION: [&str; 3] = ["auto", "always", "never"];
const OUTPUT_FORMAT: [&str; 4] = ["json", "ndjson", "tsv", "text"];
const BINARY_SHAPE: [&str; 2] = ["summary", "full"];
const ROW_COUNT_MODE: [&str; 2] = ["matched", "changed"];
const SECRET_STORAGE: [&str; 2] = ["file", "none"];
const LOG_LEVEL: [&str; 5] = ["error", "warn", "info", "debug", "trace"];
const LOG_ROTATION: [&str; 3] = ["daily", "hourly", "never"];
const POLICY_SCOPE: [&str; 2] = ["change", "all"];
const READONLY_PROBE: [&str; 2] = ["once", "always"];
const EXPORT_LOCK: [&str; 2] = ["none", "tables"];
const EPHEMERAL_NOTICE: [&str; 2] = ["on_create", "always"];
const TLS_VERIFY: [&str; 3] = ["full", "ca", "none"];
const TLS_ROOT_STORE: [&str; 3] = ["system", "bundled", "file"];
const TLS_MIN_VERSION: [&str; 2] = ["1.2", "1.3"];
const fn key(
name: &'static str,
domain: Domain,
fallback: Fallback,
about: &'static str,
) -> KeySpec {
KeySpec {
name,
domain,
fallback,
about,
}
}
use Domain::{Boolean, Enumeration, IntegerInRange, NonNegativeInteger, PositiveInteger, Text};
use Fallback::{Absent, Builtin, Host, Server};
pub(super) static REGISTRY: &[KeySpec] = &[
key(
"conn.default",
Text,
Absent,
"profile used when none is named",
),
key(
"conn.default_port",
IntegerInRange(1, 65_535),
Builtin("3306"),
"port used when a destination names none",
),
key(
"conn.require_tls",
Boolean,
Builtin("true"),
"demand an encrypted channel",
),
key(
"conn.prefer_socket",
Boolean,
Builtin("true"),
"prefer the local channel when it exists",
),
key(
"conn.timezone",
Text,
Server,
"time zone declared on the session",
),
key("conn.charset", Text, Server, "character set of the session"),
key(
"conn.compression",
Enumeration(&CHANNEL_COMPRESSION),
Builtin("auto"),
"channel compression",
),
key(
"conn.keepalive_secs",
PositiveInteger,
Builtin("60"),
"liveness signal on the channel",
),
key(
"conn.max_packet_bytes",
PositiveInteger,
Server,
"largest packet the channel accepts",
),
key(
"conn.idle_timeout_secs",
PositiveInteger,
Server,
"time until the server drops an idle session",
),
key(
"conn.stmt_cache_size",
NonNegativeInteger,
Builtin("16"),
"prepared statements kept on the session",
),
key(
"conn.session_setup",
Text,
Absent,
"adjustments applied when the session opens",
),
key(
"tls.verify",
Enumeration(&TLS_VERIFY),
Builtin("full"),
"how thoroughly the server certificate is checked",
),
key(
"tls.root_store",
Enumeration(&TLS_ROOT_STORE),
Builtin("system"),
"where the trusted authorities come from",
),
key(
"tls.min_version",
Enumeration(&TLS_MIN_VERSION),
Builtin("1.2"),
"lowest protocol version the channel negotiates",
),
key(
"output.format",
Enumeration(&OUTPUT_FORMAT),
Builtin("json"),
"shape of the primary channel",
),
key(
"output.max_rows",
PositiveInteger,
Builtin("1000"),
"ceiling on returned rows",
),
key(
"output.max_bytes",
PositiveInteger,
Builtin("1048576"),
"ceiling on total volume",
),
key(
"output.truncate_cell",
PositiveInteger,
Builtin("4096"),
"ceiling per cell",
),
key(
"output.redact",
Boolean,
Builtin("false"),
"replace credential-shaped text inside cells",
),
key(
"output.binary",
Enumeration(&BINARY_SHAPE),
Builtin("summary"),
"shape of a binary value",
),
key(
"output.count_headroom",
PositiveInteger,
Builtin("1000"),
"how far past the row ceiling an exact count may still be attempted",
),
key(
"output.near_name_count",
PositiveInteger,
Builtin("5"),
"how many near names a hint offers",
),
key(
"output.most_frequent_shown",
PositiveInteger,
Builtin("3"),
"how many of the most frequent values a summary shows",
),
key(
"limits.query_timeout_secs",
PositiveInteger,
Builtin("30"),
"ceiling for one operation",
),
key(
"limits.connect_timeout_secs",
PositiveInteger,
Builtin("10"),
"ceiling for opening the connection",
),
key(
"limits.retries",
NonNegativeInteger,
Builtin("2"),
"extra attempts on a repeatable failure",
),
key(
"limits.retry_base_ms",
PositiveInteger,
Builtin("200"),
"first wait between attempts",
),
key(
"limits.retry_deadline_ms",
PositiveInteger,
Builtin("30000"),
"longest the whole series of attempts may take",
),
key(
"limits.max_affected_rows",
PositiveInteger,
Builtin("1000"),
"ceiling on rows one change may affect",
),
key(
"limits.max_concurrency",
PositiveInteger,
Host,
"ceiling on simultaneous internal work",
),
key(
"limits.max_statement_bytes",
PositiveInteger,
Builtin("1048576"),
"largest statement this product will read",
),
key(
"limits.max_input_bytes",
PositiveInteger,
Builtin("16777216"),
"most this product will read from a file or the standard input",
),
key(
"limits.parser_stack_bytes",
IntegerInRange(1_048_576, 134_217_728),
Builtin("67108864"),
"stack given to the thread that parses",
),
key(
"limits.retry_wait_ceiling_ms",
PositiveInteger,
Builtin("6400"),
"longest a single wait between attempts may grow to",
),
key(
"limits.max_concurrency_ceiling",
PositiveInteger,
Builtin("32"),
"highest value the simultaneous work ceiling may be raised to",
),
key(
"sql.read_only",
Boolean,
Builtin("false"),
"refuse any change",
),
key(
"sql.policy_scope",
Enumeration(&POLICY_SCOPE),
Builtin("change"),
"how far a destination's own policy reaches",
),
key(
"sql.ephemeral_notice",
Enumeration(&EPHEMERAL_NOTICE),
Builtin("on_create"),
"when the notice of session state dying is emitted",
),
key(
"sql.require_where",
Boolean,
Builtin("true"),
"refuse a change without a restriction",
),
key(
"sql.require_unique_key",
Boolean,
Builtin("false"),
"refuse a change whose restriction is not on a unique key",
),
key(
"sql.local_file_read",
Boolean,
Builtin("false"),
"let the server read a local file",
),
key(
"sql.delimiter",
Text,
Builtin(";"),
"statement separator inside a file",
),
key(
"sql.row_count_mode",
Enumeration(&ROW_COUNT_MODE),
Builtin("changed"),
"what a change count means",
),
key(
"secret.storage_mode",
Enumeration(&SECRET_STORAGE),
Builtin("file"),
"how the secret is kept",
),
key(
"conn.require_explicit_target",
Boolean,
Builtin("true"),
"make a change name its destination on the call",
),
key(
"schema.index_advice",
Boolean,
Builtin("false"),
"point out a key with no index behind it",
),
key(
"schema.map_tables",
PositiveInteger,
Builtin("500"),
"how many tables the compact map draws",
),
key(
"schema.map_rows",
PositiveInteger,
Builtin("20000"),
"how many rows the compact map reads",
),
key(
"server.status_interval_secs",
PositiveInteger,
Builtin("1"),
"gap between two status samples",
),
key(
"server.readonly_probe",
Enumeration(&READONLY_PROBE),
Builtin("once"),
"how often the server is asked whether it accepts writes",
),
key(
"server.observability_visible",
Boolean,
Builtin("true"),
"offer the commands that observe other connections",
),
key(
"server.kill_foreign_requires_yes",
Boolean,
Builtin("true"),
"demand confirmation before stopping another connection",
),
key(
"import.batch_size",
PositiveInteger,
Builtin("1000"),
"rows sent to the server per batch",
),
key(
"data.rows_per_statement",
PositiveInteger,
Builtin("100"),
"rows one statement of a copy carries",
),
key(
"data.stop_on_refusal",
Boolean,
Builtin("false"),
"let one refused row stop the whole load",
),
key(
"data.export_lock",
Enumeration(&EXPORT_LOCK),
Builtin("none"),
"hold the tables still while a copy is taken",
),
key(
"log.level",
Enumeration(&LOG_LEVEL),
Builtin("error"),
"detail of the auxiliary channel",
),
key(
"log.to_file",
Boolean,
Builtin("false"),
"write diagnostics to a file",
),
key(
"log.rotation",
Enumeration(&LOG_ROTATION),
Builtin("daily"),
"how the diagnostic file turns over",
),
key(
"log.retention",
PositiveInteger,
Builtin("7"),
"how many diagnostic files are kept",
),
key("i18n.lang", Text, Host, "language of messages"),
];