#include "bees-config.h"
+// FROZEN. This is the schema bees v0.11 shipped, kept so an installation can
+// go on resolving the defaults it has been running (config.version = 1, or the
+// v0.11 alias). The values here are a record of a past release rather than a
+// starting point: editing one changes what an already-deployed installation
+// resolves to the next time it upgrades, which is the one thing versioning the
+// schema exists to prevent. New options and changed defaults belong in the
+// highest-numbered bees-config-v*.cc.
static const char bees_config_v1[] = R"--v1-config--(
# The [config] section controls config file sources and versioning.
[report.*]
- # Whether this report output is active.
- # Both active = yes and a non-empty filename are required to write.
- # The $BEESSTATUS environment variable overrides report.legacy.filename
- # and activates report.legacy regardless of this key.
+ # Whether this report output is active. yes/no.
+ # Writing also requires a non-empty filename.
active = no
# Target interval between rewrites of this report file.
# Minimum: 0.1s.
interval = 1s
- # Final permission mode for the report file (octal).
- # Applied via fchmod after writing, before the atomic rename into place.
- # Write bits are never needed: report files are always written via a
- # temporary file and renamed into place atomically.
+ # Permission mode for the report file (octal).
mode = 0400
# syslog-style level (0=EMERG ... 6=INFO, 7=DEBUG) used when the report
# is emitted to the log (filename = -). Ignored for file reports.
level = 6
- # Owner of the report file. Accepts a name or numeric uid.
- # Resolved to a uid once at startup; an unknown name is a config error.
- # Empty = no chown; file is owned by the bees process user.
+ # Owner of the report file: a name, a numeric uid, or empty for no
+ # chown. A leading ':' forces a name lookup (e.g. ':1000').
user =
- # Group of the report file. Accepts a name or numeric gid.
- # Resolved to a gid once at startup; an unknown name is a config error.
- # Empty = no chown; file is owned by the bees process group.
+ # Group of the report file: a name, a numeric gid, or empty for no
+ # chown. A leading ':' forces a name lookup (e.g. ':1000').
group =
# Filename of the report file.
persistent = yes
# Auto-create path.home and beeshash.dat if they do not exist.
- # When yes, bees creates the path.home directory at startup if
- # it is missing. When no, startup fails if path.home or
- # beeshash.dat is missing.
- # Has no effect when state.persistent = no.
+ # Set to no to require both to be present at startup.
create = yes
# The [state.hash] section controls hash table file options.
/// Map of version string -> built-in default INI text.
using DefaultMap = map<string, Innie>;
static unique_ptr<DefaultMap> s_defaults;
- /// Version of the config schema currently in use.
- static constexpr const char *s_current_version = "1";
- /// Oldest config schema version that is fully compatible.
+ /// Newest config schema in this build: the one under development, and
+ /// what CURRENT resolves to.
+ static constexpr const char *s_current_version = "2";
+ /// Oldest config schema that is still fully compatible with this build,
+ /// and what STABLE resolves to. Version 1 is frozen at what v0.11
+ /// shipped; it stays compatible for as long as version 2 defines no key
+ /// that version 1 lacks.
static constexpr const char *s_stable_version = "1";
/** \brief Named aliases accepted wherever a config schema version is.
"max",
};
-/// Expected legacy-id for each tier (matches bees-config-v1.cc).
+/// Expected legacy-id for each tier (matches bees-config-v2.cc).
static const map<string, uint64_t> s_expected_legacy_id {
{ "128K", 255 },
{ "512K", 254 },
bcs.m_max_transid = d.at("max_transid");
bcs.m_started = d.at("started");
- // Build legacy_id_to_name from a synthetic config (mirrors bees-config-v1.cc).
+ // Build legacy_id_to_name from a synthetic config (mirrors bees-config-v2.cc).
// In production, import_legacy() reads from m_ctx->get_config().sections().
const string config_text =
"[scan.extent.*]\n"
void
test_config_legacy_ids()
{
- // Mini config that replicates the [scan.extent.*] sections from bees-config-v1.cc.
+ // Mini config that replicates the [scan.extent.*] sections from bees-config-v2.cc.
const string config_text =
"[scan.extent.*]\n active = yes\n method = 0\n"
"[scan.extent.128K]\n legacy-id = 255\n"