Elektra
0.9.3
|
Currently it is inefficient to detect the length of an array and it is impossible to know if a key (without subkeys) should be an array or not.
###empty_array
as in yajl
, problem: does not allow efficient access of first element#_...
array
, problem: is ambiguousStore length in metadata array
of key, or keep metadata array
empty if empty array. For example (ni syntax
, sections used for metadata):
It is not allowed to have anything else than #5
in the metadata array
, e.g. even #4
would be a malformed array.
The metadata array
preferable should be in spec
(specified configuration). Then the spec
plugin will add the array
marker with the correct length. This needs to be happen early, so that plugins can rely on having correct arrays.
For example:
Here, the spec
plugin would add array=#1
to user:/myarray
if it was not there before.
To lookup an array, first do ksLookupByName (ks, "/myarray", 0)
on the parent. With the last index you get from its metadata array
, iterate over the children. A cascading lookup on every individual child is also needed to make sure that overrides on individual elements are respected.
For example:
Guarantees we want from the spec plugin:
array
.array
#
childrenbinary
metadata.#0
#
intermixed with non #
keys) which is a possibility also in all the alternatives of this decision.user:/
or dir:/
key can change the semantics of a system:/
array, if not avoided by spec
.