$darkmode
|
Elektra 0.11.0
|
A KeySet is powerful data structure, which could be use for data other than configuration data. Especially with the hashmap implementation, using a KeySet for generic data can be useful. For this generic data we do not care about the namespace-related features.
However, because a Key cannot exist without a namespace, we need to choose a namespace.
KeySetsTypes of `KeySet`s" decision".KeySetsTypes of `KeySet`s" decision" leads to separate types of KeySets that are restricted w.r.t. the namespaces they may contain.We could use the existing KEY_NS_CASCADING for one of the types of KeySets.
This may be confusing to users of the APIs. The purpose of KEY_NS_CASCADING becomes muddied. It is no longer just for lookup, but would now have a secondary purpose.
We introduce a new KEY_NS_MISC, which is used exclusively for generic and miscellaneous data. It implies a separate type of `KeySet`.
This leaves KEY_NS_CASCADING for its original purpose, while still solving the issue with generic data.
Introduce separate KEY_NS_MISC namespace.
In the unescaped form this will be \x09 (byte with decimal value 9). In the escaped form it will be misc:/.
KEY_NS_MISC has a separate type of `KeySet`. Such a KeySet can only contain KEY_NS_MISC keys. It may not be used for metadata or with kdbGet/kdbSet.
A cascading lookup is still allowed for such KeySets. However, the KEY_NS_CASCADING will simply be replaced with KEY_NS_MISC and then an exact name lookup is performed, as if the KEY_NS_MISC namespace was given directly.
Introducing a new namespace is much cleaner than reusing one of the existing ones. It fits better with the separate types of `KeySet`s.
KEY_NS_MISC.ksLookup needs to adapted for KEY_NS_MISC.KeySetsTypes of `KeySet`s"".