-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
backend plugin #2969
backend plugin #2969
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for creating this PR!
## Considered Alternatives | ||
|
||
- Multiple storage plugins within a single backend | ||
- Plugin containing more plugin slots |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can link to the list plugin here.
fallback storage options. | ||
|
||
## Implications | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One important implication is that we need a hard-coded default backend, similar to the default storage and resolver we already have.
I'm currently working on moving backendOpen in backend.c to elektraBackendOpen in the backend plugin, one notable function which is called there is elektraProcessPlugins, which builds up the plugin arrays. Since this is implementation specific for backends (correct me if I'm wrong), the idea would be to move the function to the backend plugin and call it there (modified to work with the new array structure). Since elektraPluginOpen and elektraProcessPlugin are exported, they can be called there as well. Most of the arguments the function needs can be accessed from within the plugin as well: The only argument I'm not sure about is the KeySet modules, since it is neither given to the plugin nor as an argument, but is necessary to call elektraPluginOpen. My idea would be to give the keyset to the plugin using the data field which is available in the plugin struct and make it possible to access the keyset that way. Is that a valid way to solve this or is this too much of a workaround? |
exactly
Maybe we should get rewrite of this code. If you add any number of plugins in the middle of this code, it might be very confusing. Did you already design how the new system/elektra/mountpoints will look like?
It is a good idea but use a new |
The new mountpoints will have the mountpoint key moved under config/mountpoint, like config/path, that way they can be assigned to the plugins and read out. The easiest solution would be to add the mountpoint variable to the plugin struct, but I'm not sure if it is useful enough for other plugins like the modules keyset. Another thing that needs to be changed in the mountpoint configuration is the allocation of plugins in the arrays, since array numbers are currently being used to define a plugin's respective slot. I would like to change the numbers to the actual names of the roles. For example:
is changed to
That way it is possible to have more flexible numbers of plugins. This means that, among other things, I need to change the default configuration, as well as the configuration created when new backends are mounted. However, I am not sure where I can find these configurations, I was able to find |
Thank you, can you please write this in the documentation?
Do we need the
It is created from the With the tests it should be easy to understand what the code does. outputGTest allows you to generate regression tests. Current regression tests (you will need to fix them) are in src/libs/tools/testtool_backend.cpp |
Thank you for the answers! I agree that the |
Can you write up everything including a full example? It is easier to see how it looks like then. |
The keyset has been added to the Plugin struct and elektraPluginOpen. Discussed in ElektraInitiative#2969.
I'll use the mount point configuration from
The notable changes are the following:
That way, the |
I made a rough implementation of elektraBackendOpen. I am currently working on implementing the other plugin functions, as well as writing appropriate tests and documentation. |
Can you put all the text you put here directly as text into the docu? It is much easier to review then (can also be in a separate PR).
fstab is not a valid mountpoint. It must be \/fstab, user\/fstab or similar (at least one \/ must be present to be valid)
Why is =fstab here not in ()?
The struct plugin was removed and fstab is not finished, so better you use some other example (e.g. hosts with glob).
Very nice idea.
Maybe we can get rid of some redundancy here.
This is a big step forward. Did you also consider to completely separate the definitions of plugins and their use in the positions?
I think @sanssecours will prefer reference instead of ref here 😉 @kodebach do you also want to share some thoughts here? |
Everything here seems good to me.
We should also ensure in CMake that there is no way to build Elektra without the default storage, resolver and backend plugins. I think right now, you could exclude them from the plugin list and get a broken build. At the least there should be an obvious warning from CMake. |
Yes, I agree that CMake should not succeed until the default-backend plugin is included. For resolver/storage this should already be the case, see src/plugins/CMakeLists.txt lines 67 and 76. Please open an issue if you find a way how to fail during compilation. |
Those checks are only applied during I think adding something like libelektra/src/tools/kdb/CMakeLists.txt Lines 30 to 33 in 4db328f
(and a few lines below for IMO |
I would not spent too much time on the build system. The sub-targets are for expert use only as we do not mention or encourage them anywhere. But of course you are free to send patches 😉 |
The CLion tutorial kind of mentions them. But yes, its a minor issue. |
Thank you, I was not aware of that. Any specific reason why this is mentioned there? |
It actually just says that you can run individual tests by executing "any of the testmod_* or testkdb_*targets". In most cases that should work fine (especially |
At least on the command-line it is not like this. When I execute
For me there is no noticeable difference between building everything vs. building a single target if everything was already build before. So why not simply always call the |
CLion automatically creates run configurations for all (executable) CMake targets. For target
Depends what you modified. Modifications to some CMake files for example invalidate a big chunk of the project. If you use
As stated above, the CLion run configurations are created automatically. You would have to manually change them to do that (or not use them).
Even on my Ryzen 7 3700X system (using Besides that, using e.g. |
This pull request introduces 1 alert when merging ba43e5a into ed6fd9b - view on LGTM.com new alerts:
|
Simple |
Most plugins probably expect that the
That is actually a somewhat known bug, see #3299. The bug itself is almost certainly unrelated to your changes. It can appear, if certain tests fail. As a workaround you can delete the Alternatively, you can run tests separately with You can also use If you can't find the problematic test, try to fix the other ones first maybe the bug goes away in the process. |
Yes, please ignore this at least until #3299 is resolved. If it goes away by disabling the cache, simply disable the cache for now. It is actually very likely that the cache does not work as expected with such huge changes to the backends, even if we disregard #3408 If you want I can push changes to this branch which should definitely disable the cache, and we will take a look together once everything else is resolved. I think this makes the most sense. It will be very hard to debug things if there are errors in the core (or backend implementation) and in the cache as well. I think it's better to focus on the core and backend plugin right now. |
@mpranj that would make things a lot easier, thank you! That way I can clear up the errors on my side. |
I disabled it now as it would be disabled on the master branch. I don't know if there are any other changes which I am not aware of. Whenever you are unsure, you can also use -DPLUGINS="ALL;-cache" when running cmake, which is an alternative approach to what I pushed. |
Thank you very much! |
This pull request introduces 1 alert when merging 2be8b40 into ed6fd9b - view on LGTM.com new alerts:
|
I was held up in traffic on my way back from Slovenia, so I won't be able to make it to the meeting today, unfortunately. The plugin is working now, I can do basic I am working on getting all the tests running, and I noticed that the I work full time from November onwards, so it will be difficult for me to find time for Elektra after that. That is why I will take next week and the weekend off from work to focus on the project and get as much work done as possible. I intend to finish my work during that week, but it could also happen that unforeseen issues pop up and I cannot finish all the work in time. In November, I will be unable to invest greater amounts of time into the project, but I will be available to help out in case of questions and provide minor fixes. However, I do intend to finish my work next week, and I hope that this won't be an issue in the first place. |
Thank you, yes, I also think there is enough time in October. Would be amazing to get this merged soon! 💖 |
@vLesk how is it going on? Do you need some specific help? |
@markus2330 thanks for asking! I have a question,
My question in order to find and fix the problem is, where can I find the |
libelektra/src/plugins/type/README.md Lines 179 to 291 in 4146061
The tests are quite hard to debug. But if all of them fail, there is probably a quite severe bug. You should be able to narrow things down by manually executing the shell commands one after another. The exact format used in the comments of these shell scripts is documented in |
Thank you @kodebach! It seems that the issue is not with the tests themselves, but with mounting in general, the config does not seem to be stored correctly, I'm looking into it. |
@vLesk any update? Can you describe us what does not work? 💖 |
I hope we can get this into 0.9.5. @vLesk do you have any status update? Can you find some time? Now would be a good time for a rebase, we upgraded to clang-format-11. |
I'm closing this PR, since it takes for every to load on GitHub. I will open a new PR with a rebased version of this, once #3651 is merged. |
Thank you so much! 💖 I just read yesterday in #3461 that it would be great to have this backend plugin finally fixed. |
Squashed version of: decisions: added decision for backend plugin Discussed in ElektraInitiative#2963 backend: added basic files for backend plugin Discussed in ElektraInitiative#2963 plugin: added the modules keyset to plugins The keyset has been added to the Plugin struct and elektraPluginOpen. Discussed in ElektraInitiative#2969. backend: implemented elektraBackendOpen Discussed in ElektraInitiative#2969. backend: implemented elektraBackendGet Discussed in ElektraInitiative#2969. documentation: updated documentation reflecting the changed mount point configuration Changed documents: - architecture.md - plugins-ordering.md - README.md in src/plugins Discussed in ElektraInitiative#2969. backend: made basic implementation of elektraBackendSet, elektraBackendCommit and elektraBackendError Discussed in ElektraInitiative#2969. backend: Added implications to decision for the backend plugin Discussed in ElektraInitiative#2969. documentation: Modified role names in plugins-ordering Discussed in ElektraInitiative#2969. kdbprivate: Added definitions of new plugin positions, still need to remove old ones Discussed in ElektraInitiative#2969. cpp tools: made basic modifications to conform with new backend plugin Still incomplete, the tests do not pass yet. Discussed in ElektraInitiative#2969. testtool_backend: modified tests to conform to new backend configuration Discussed in ElektraInitiative#2969. backend: modifications to clear compiler errors, moved plugin position definitions to kdbprivate Discussed in ElektraInitiative#2969. backend: modified plugin functions to be called once per plugin role Discussed in ElektraInitiative#2969. backend: changed function calls to match new api Revert "cpp tools: made basic modifications to conform with new backend plugin" This reverts commit 63a10fe. tools: modified libs/tools to be compatible with the new backend plugin Discussed in ElektraInitiative#2969. backend: changed back the names of the roles of a backend Discussed in ElektraInitiative#2969. backend: changed back the names of the roles in a backend Discussed in ElektraInitiative#2969. kdbprivate: modified functions and structs to support the backend plugin Discussed in ElektraInitiative#2969. version: implemented external version plugin to work with the backend plugin Related to ElektraInitiative#2969. missing: implemented external missing plugin for compatibility with backend plugin Related to ElektraInitiative#2969. backend.c: modified backend functions to conform with new backend plugin and removed unneeded functions Discussed in ElektraInitiative#2969. missing: reformatted code style version: reformatted code style backend: restyled code Related to ElektraInitiative#2969. tools: restyled code Related to ElektraInitiative#2969. backend: restyled code Related to ElektraInitiative#2969. backend: first modifications for compatibility with the backend plugin, more to come Discussed in ElektraInitiative#2969. mount: modifications for compatibility with the backend plugin Discussed in ElektraInitiative#2969. plugin.c: restyled code Related to ElektraInitiative#2969. split: modifications for compatibility with backend plugin Related to ElektraInitiative#2969. trie: modifications for compatibility with the backend plugin Discussed in ElektraInitiative#2969. plugin.c: removed unnecessary functions Discussed in ElektraInitiative#2969. split: moved keyset sizes from backend to split and modified backendUpdateSize Discussed in ElektraInitiative#2969. kdbEnsure: commented out the ensurePluginUnmounted function until it is made compatible with the backend plugin Discussed in ElektraInitiative#2969. kdb: modified kdb functions to use the backend plugin Discussed in ElektraInitiative#2969. tests.c: modified tests to support backend plugin and new split structure Discussed in ElektraInitiative#2969. backend: modified test_backend and moved it to the backend plugin Related to ElektraInitiative#2969. backend: partially implemented tests, commented out places in tests that did not work Discussed in ElektraInitiative#2969. backend: minor debugging changes Discussed in ElektraInitiative#2969. testmod_backend: finished tests Discussed in ElektraInitiative#2969. umount: modified tests to use new configuration Discussed in ElektraInitiative#2969 backend: changed mount point of default backend Part of ElektraInitiative#2969 backend: fixed bug in elektraBackendClose which called elektraPluginClose on the wrong plugin array testmod_backend: partially fixed memory leaks backend: finished fixing memory leaks Based on ElektraInitiative#2969 backend: fix some memory problems backend: fixed wrong arguments when calling kdbGet Based on ElektraInitiative#2963 backend: fixed bug where the wrong plugin was passed to plugin function calls reformatted code mount: added check not to call backendOpenModules for the backend plugin itself Based on ElektraInitiative#2969 backend: Made kdbGet return ELEKTRA_PLUGIN_STATUS_SUCCESS in the resolver phase if there is no resolver Based on ElektraInitiative#2969 backend, kdb: reformatted code Based on ElektraInitiative#2969 cache: disable cache mount
Squashed version of: decisions: added decision for backend plugin Discussed in ElektraInitiative#2963 backend: added basic files for backend plugin Discussed in ElektraInitiative#2963 plugin: added the modules keyset to plugins The keyset has been added to the Plugin struct and elektraPluginOpen. Discussed in ElektraInitiative#2969. backend: implemented elektraBackendOpen Discussed in ElektraInitiative#2969. backend: implemented elektraBackendGet Discussed in ElektraInitiative#2969. documentation: updated documentation reflecting the changed mount point configuration Changed documents: - architecture.md - plugins-ordering.md - README.md in src/plugins Discussed in ElektraInitiative#2969. backend: made basic implementation of elektraBackendSet, elektraBackendCommit and elektraBackendError Discussed in ElektraInitiative#2969. backend: Added implications to decision for the backend plugin Discussed in ElektraInitiative#2969. documentation: Modified role names in plugins-ordering Discussed in ElektraInitiative#2969. kdbprivate: Added definitions of new plugin positions, still need to remove old ones Discussed in ElektraInitiative#2969. cpp tools: made basic modifications to conform with new backend plugin Still incomplete, the tests do not pass yet. Discussed in ElektraInitiative#2969. testtool_backend: modified tests to conform to new backend configuration Discussed in ElektraInitiative#2969. backend: modifications to clear compiler errors, moved plugin position definitions to kdbprivate Discussed in ElektraInitiative#2969. backend: modified plugin functions to be called once per plugin role Discussed in ElektraInitiative#2969. backend: changed function calls to match new api Revert "cpp tools: made basic modifications to conform with new backend plugin" This reverts commit 63a10fe. tools: modified libs/tools to be compatible with the new backend plugin Discussed in ElektraInitiative#2969. backend: changed back the names of the roles of a backend Discussed in ElektraInitiative#2969. backend: changed back the names of the roles in a backend Discussed in ElektraInitiative#2969. kdbprivate: modified functions and structs to support the backend plugin Discussed in ElektraInitiative#2969. version: implemented external version plugin to work with the backend plugin Related to ElektraInitiative#2969. missing: implemented external missing plugin for compatibility with backend plugin Related to ElektraInitiative#2969. backend.c: modified backend functions to conform with new backend plugin and removed unneeded functions Discussed in ElektraInitiative#2969. missing: reformatted code style version: reformatted code style backend: restyled code Related to ElektraInitiative#2969. tools: restyled code Related to ElektraInitiative#2969. backend: restyled code Related to ElektraInitiative#2969. backend: first modifications for compatibility with the backend plugin, more to come Discussed in ElektraInitiative#2969. mount: modifications for compatibility with the backend plugin Discussed in ElektraInitiative#2969. plugin.c: restyled code Related to ElektraInitiative#2969. split: modifications for compatibility with backend plugin Related to ElektraInitiative#2969. trie: modifications for compatibility with the backend plugin Discussed in ElektraInitiative#2969. plugin.c: removed unnecessary functions Discussed in ElektraInitiative#2969. split: moved keyset sizes from backend to split and modified backendUpdateSize Discussed in ElektraInitiative#2969. kdbEnsure: commented out the ensurePluginUnmounted function until it is made compatible with the backend plugin Discussed in ElektraInitiative#2969. kdb: modified kdb functions to use the backend plugin Discussed in ElektraInitiative#2969. tests.c: modified tests to support backend plugin and new split structure Discussed in ElektraInitiative#2969. backend: modified test_backend and moved it to the backend plugin Related to ElektraInitiative#2969. backend: partially implemented tests, commented out places in tests that did not work Discussed in ElektraInitiative#2969. backend: minor debugging changes Discussed in ElektraInitiative#2969. testmod_backend: finished tests Discussed in ElektraInitiative#2969. umount: modified tests to use new configuration Discussed in ElektraInitiative#2969 backend: changed mount point of default backend Part of ElektraInitiative#2969 backend: fixed bug in elektraBackendClose which called elektraPluginClose on the wrong plugin array testmod_backend: partially fixed memory leaks backend: finished fixing memory leaks Based on ElektraInitiative#2969 backend: fix some memory problems backend: fixed wrong arguments when calling kdbGet Based on ElektraInitiative#2963 backend: fixed bug where the wrong plugin was passed to plugin function calls reformatted code mount: added check not to call backendOpenModules for the backend plugin itself Based on ElektraInitiative#2969 backend: Made kdbGet return ELEKTRA_PLUGIN_STATUS_SUCCESS in the resolver phase if there is no resolver Based on ElektraInitiative#2969 backend, kdb: reformatted code Based on ElektraInitiative#2969 cache: disable cache mount
Squashed version of: decisions: added decision for backend plugin Discussed in ElektraInitiative#2963 backend: added basic files for backend plugin Discussed in ElektraInitiative#2963 plugin: added the modules keyset to plugins The keyset has been added to the Plugin struct and elektraPluginOpen. Discussed in ElektraInitiative#2969. backend: implemented elektraBackendOpen Discussed in ElektraInitiative#2969. backend: implemented elektraBackendGet Discussed in ElektraInitiative#2969. documentation: updated documentation reflecting the changed mount point configuration Changed documents: - architecture.md - plugins-ordering.md - README.md in src/plugins Discussed in ElektraInitiative#2969. backend: made basic implementation of elektraBackendSet, elektraBackendCommit and elektraBackendError Discussed in ElektraInitiative#2969. backend: Added implications to decision for the backend plugin Discussed in ElektraInitiative#2969. documentation: Modified role names in plugins-ordering Discussed in ElektraInitiative#2969. kdbprivate: Added definitions of new plugin positions, still need to remove old ones Discussed in ElektraInitiative#2969. cpp tools: made basic modifications to conform with new backend plugin Still incomplete, the tests do not pass yet. Discussed in ElektraInitiative#2969. testtool_backend: modified tests to conform to new backend configuration Discussed in ElektraInitiative#2969. backend: modifications to clear compiler errors, moved plugin position definitions to kdbprivate Discussed in ElektraInitiative#2969. backend: modified plugin functions to be called once per plugin role Discussed in ElektraInitiative#2969. backend: changed function calls to match new api Revert "cpp tools: made basic modifications to conform with new backend plugin" This reverts commit 63a10fe. tools: modified libs/tools to be compatible with the new backend plugin Discussed in ElektraInitiative#2969. backend: changed back the names of the roles of a backend Discussed in ElektraInitiative#2969. backend: changed back the names of the roles in a backend Discussed in ElektraInitiative#2969. kdbprivate: modified functions and structs to support the backend plugin Discussed in ElektraInitiative#2969. version: implemented external version plugin to work with the backend plugin Related to ElektraInitiative#2969. missing: implemented external missing plugin for compatibility with backend plugin Related to ElektraInitiative#2969. backend.c: modified backend functions to conform with new backend plugin and removed unneeded functions Discussed in ElektraInitiative#2969. missing: reformatted code style version: reformatted code style backend: restyled code Related to ElektraInitiative#2969. tools: restyled code Related to ElektraInitiative#2969. backend: restyled code Related to ElektraInitiative#2969. backend: first modifications for compatibility with the backend plugin, more to come Discussed in ElektraInitiative#2969. mount: modifications for compatibility with the backend plugin Discussed in ElektraInitiative#2969. plugin.c: restyled code Related to ElektraInitiative#2969. split: modifications for compatibility with backend plugin Related to ElektraInitiative#2969. trie: modifications for compatibility with the backend plugin Discussed in ElektraInitiative#2969. plugin.c: removed unnecessary functions Discussed in ElektraInitiative#2969. split: moved keyset sizes from backend to split and modified backendUpdateSize Discussed in ElektraInitiative#2969. kdbEnsure: commented out the ensurePluginUnmounted function until it is made compatible with the backend plugin Discussed in ElektraInitiative#2969. kdb: modified kdb functions to use the backend plugin Discussed in ElektraInitiative#2969. tests.c: modified tests to support backend plugin and new split structure Discussed in ElektraInitiative#2969. backend: modified test_backend and moved it to the backend plugin Related to ElektraInitiative#2969. backend: partially implemented tests, commented out places in tests that did not work Discussed in ElektraInitiative#2969. backend: minor debugging changes Discussed in ElektraInitiative#2969. testmod_backend: finished tests Discussed in ElektraInitiative#2969. umount: modified tests to use new configuration Discussed in ElektraInitiative#2969 backend: changed mount point of default backend Part of ElektraInitiative#2969 backend: fixed bug in elektraBackendClose which called elektraPluginClose on the wrong plugin array testmod_backend: partially fixed memory leaks backend: finished fixing memory leaks Based on ElektraInitiative#2969 backend: fix some memory problems backend: fixed wrong arguments when calling kdbGet Based on ElektraInitiative#2963 backend: fixed bug where the wrong plugin was passed to plugin function calls reformatted code mount: added check not to call backendOpenModules for the backend plugin itself Based on ElektraInitiative#2969 backend: Made kdbGet return ELEKTRA_PLUGIN_STATUS_SUCCESS in the resolver phase if there is no resolver Based on ElektraInitiative#2969 backend, kdb: reformatted code Based on ElektraInitiative#2969 cache: disable cache mount
Implementing the
backend
plugin. Still under construction :)Discussed in #2963
Basics
Check relevant points but please do not remove entries.
Do not describe the purpose of this PR in the PR description but:
doc/news/_preparation_next_release.md
which contains_(my name)_
)Please always add something to the the release notes.
(first line should have
module: short statement
syntax)close #X
, should be in the commit messages.Checklist
Check relevant points but please do not remove entries.
For docu fixes, spell checking, and similar none of these points below
need to be checked.
Review
Reviewers will usually check the following:
Labels
say that everything is ready to be merged.