Replies: 2 comments 5 replies
-
|
I agree that something like this is needed (not only for metadata but also for some storage plugins which need several keys at once) but I don't see big urgency (i.e. the issue is post-1.0) as we have Btw. the now-gone tcl plugin supported a very similar syntax you proposed here |
Beta Was this translation helpful? Give feedback.
-
|
Looks like a very nice enhancement to me as well. I would, however, convert it to an issue so it does not get lost here. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
It can often be useful to set multiple metakeys (even if the metadata may not be stored as such) together in one atomic operation.
In most cases I know of, there is an order in which you can set the metakeys to make things work. But theoretically there could be plugin, where you need to set metakeys together and there should be an error, if not all required metakeys are set.
For example, take this simplified snippet from the WIP update to
toml:You need to set the meta-keys in this specific order to the the expected formatting. This is because of the way the
tomlplugin fills in the other required parameters and because of the way comments are read. Yes, this could be fixed intoml, but there are other examples where this is not possible. Take for example thetypeplugin with anenumkey:This will not work in any order. For example, you obviously setting
type = enumbefore addingmiddleto the enum values will fail. This is not something that can be solved by changing thetypeplugin, because this is the intended behaviour.To solve such cases, it would be nice, if we could set the value of a key and its metadata in one atomic command. This is easy to implement, since
kdbSet()is atomic anyway and you can change as much as you want betweenkdbGet()andkdbSet().I therefore propose this extension to
kdb meta-set:I think the following would be more readable, but we can only implement it, if we accept that the
kdbtool cannot set metakeys that contain a=or implement yet another escaping mechanism. IMO it would be fine, sincekdb mountalready uses=for plugin config, sokdbalready doesn't universally except every possible key name.There may also be a use-case for setting not just multiple metakeys in one go, but also set the key value at the same time. For this we could add an extension to
kdb set. However, I don't know of a use case right now, so I would consider this low priority.The syntax for
kdb setcould be (assuming=is okay):@markus2330 What do you think?
Beta Was this translation helpful? Give feedback.
All reactions