Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Issues with JNA integration #2235
I am trying to write a java application which interacts with kdb via JNA. I tried to make a
Here is my setup (and really no other key below user):
kdb set user/user/test c kdb setmeta user/user/test check/enum "a, b, c"
In my java application I load this keyset from above (only these keys!) and try to pass it to the
Key key = Key.create("user/user"); KeySet set = .. loaded KeySet via JNA binding Plugin plugin = INSTANCE.elektraPluginOpen("enum", null, set.get(), key.get()); //.get() returns the pointer to the keyset set.rewind(); int returnCode = plugin.kdbSet.invoke(plugin, set.get(), key.get());
I came up to a few Questions until now:
Also this does not work just in kdb:
kdb mount test.conf /test dump enum kdb setmeta /test/enum check/enum "a, b, c" kdb set /test/enum "d" #> Error message telling me that "d" is not in enum kdb lsmeta /test #> Did not find key ##Shouldn't this give me the error message?!
What is the
What are those
Simply pass on the parentKey you got. The name of the parentKey must be the mountpoint, the string must be the config's filename.
No, only writing to config files rejects invalid configs. Otherwise you would not be able to do anything after invalid entries are in the files.
Seems like the enum plugin does not rewind by itself. KDB always rewinds, so you should rewind to. Please update this information in the description of how the plugin system works.
The plugin handle can be used to store data and to get the plugin's configuration. For more information see src/include/kdbplugin.h (elektraPluginGetConfig elektraPluginSetData elektraPluginGetData)
The modules could be used to load any module, currently the module loader is only used to load plugins. For more info see src/libs/loader/
Thank you, there were indeed some additional metakeys! It looks like the
Here are is the key + all meta values:
There should be a good error message though as I can see this codesnippet:
Just for curiousity: What happens if multiple errors occur? How do the metakeys look then?
You mean I should not need to rewind?
Thanks for the clarification.
The difference in the error message seems rather pointless, it would be good to improve these error messages.
This is also a question of the plugin interface: there only can be one error. Iirc the first one wins, the others are appended as warnings. But please test if this is actually the case and document it. It was improved some time ago by @tom-wa.
Within the plugins you do not need to rewind. If you implement a plugin loader and call other plugins, you need to rewind. So it is a precondition for the plugins that they get a rewinded keyset. Please document this.
When executing a wrong
I will make a PR this afternoon which explains the rewind :)
Alright, after some long tinkering I found out my system (or tbh myself) mixed apt-get installations with make install installations. The error message now is correct. Probably it was an old version from apt-get which still had the bad enum error message set.
Nonetheless thanks for your help!