Expand description
Environment overrides for configuration keys holding a sequence of tagged tables.
Such a sequence is what a Vec of externally tagged enums serializes to, for
example the region_engine option:
[{"mito": {...}}, {"file": {...}}]Handing the plain [Environment] source to config cannot work for these keys:
config writes every flat dotted key by walking down its path, and the walk resets
any intermediate value that is not a table. Walking region_engine.mito.index.aux_path
therefore destroys the default sequence before anything is set.
This source instead addresses the entries by their tag name and merges the overrides onto the matching default entries:
GREPTIMEDB_STANDALONE__REGION_ENGINE__MITO__INDEX__AUX_PATH=...Entries that only the environment mentions are appended, and every field that is not mentioned keeps its default value. A configuration file that configures the whole sequence replaces the merged one, which makes these variables ineffective; the file has to spell out every entry it wants.
Structsยง
- Tagged
SeqEnv ๐Source - A [
Source] that merges environment overrides into sequences of tagged tables. - Target ๐
- One sequence of tagged tables that the environment may override.
Functionsยง
- apply_
override ๐ - Merges the override of the entry
tagintoentry, whose only key istag. - deep_
merge ๐ - Merges
incomingintobase, recursively for tables. Returns the dotted path of the field that cannot be merged into, whenbaseholds a non-table value whereincomingneeds a table. - default_
entries ๐ - Returns the default entries of
target, each one a single-key table{tag: table}. - entry_
path ๐ - Builds the dotted path of
pathbelow the entrytagoftarget. - group_
entries ๐ - Groups the overrides by tag, nesting every field path into a table.
- invalid_
default ๐ - is_
index_ ๐like - Whether
taglooks like a position in the sequence rather than an engine name. - json_
to_ ๐value - Converts a default value parsed from the JSON serialization of the options.
- merge ๐
- Rebuilds the sequence of
targetwith the environment overridesentriesapplied. - merge_
at ๐ - nest ๐
- Builds a table whose key path is the dotted
path, e.g.a.bandvgive{a: {b: v}}. - not_
a_ ๐table - Error for a field whose default value is not a table, so nothing can be set below it.
- overrides_
conflict ๐ - Error for a key that sets a field below a path another key sets as a whole.
- single_
tag ๐ - Returns the tag of
entry, which must map one tag to a table. - take_
entries ๐ - Removes and returns the entries that address
keyitself or one of its children.