* Numeric version (e.g. `1`)
* `STABLE` – most recent released configuration version. This _does_ change with new bees releases. It is the default for tagged releases and release candidates.
* `CURRENT` – most recent development version. This changes between bees releases in order to enable experimental new features. It is the default for untagged development versions between releases.
+ * A release alias such as `v0.11` – the configuration version that the named release shipped. Unlike `STABLE` and `CURRENT`, a release alias names a frozen version, so it keeps its meaning across upgrades.
* **`global-config-filename`**
Path to the optional system-wide config file.
THROW_CHECK1(runtime_error, key, rv.second);
}
+const map<string, string> &
+BeesConfig::version_aliases()
+{
+ static const map<string, string> s_aliases {
+ { "STABLE", s_stable_version },
+ { "CURRENT", s_current_version },
+ // bees v0.11 shipped config schema version 1. That schema is
+ // frozen, so the release name goes on selecting it however far
+ // CURRENT moves ahead.
+ { "v0.11", "1" },
+ };
+ return s_aliases;
+}
+
BeesConfig::BeesConfig(const string &path, const Fd &fd) :
m_root_fd(fd),
m_root_path(path)
}
// Set version aliases
- insert_map_unique(*s_defaults, "STABLE", s_defaults->at(s_stable_version));
- insert_map_unique(*s_defaults, "CURRENT", s_defaults->at(s_current_version));
+ for (const auto &i : version_aliases()) {
+ insert_map_unique(*s_defaults, i.first, s_defaults->at(i.second));
+ }
}
string
/// Oldest config schema version that is fully compatible.
static constexpr const char *s_stable_version = "1";
+ /** \brief Named aliases accepted wherever a config schema version is.
+
+ Two kinds of name live here. STABLE and CURRENT track this build
+ and therefore resolve through the constants above, so they name a
+ different schema as the constants move. A release alias such as
+ "v0.11" names a frozen schema directly and keeps naming it no
+ matter how far development has moved on.
+
+ Every consumer resolves through this one table so a name cannot
+ mean one thing in the defaults map and another somewhere else.
+ */
+ static const map<string, string> &version_aliases();
+
/// Hierarchy of Innies (one per config layer)
Innie m_argv; ///< Values provided via command-line flags.
Innie m_local; ///< Values from the per-filesystem config file.