-
Notifications
You must be signed in to change notification settings - Fork 50
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
clean up KVS API implementation #1099
Conversation
Problem: the client API implementation of "getat", validates that the root treeobj, but the server accepts anything. This leaves the KVS module somewhat vulnerable malformed input. Move validation to the KVS module.
This test runs --verbose, these errors are omitted: ./t1002-kvs-cmd.t: 352: [: 0: unexpected operator ./t1002-kvs-cmd.t: 352: [: 0: unexpected operator ./t1002-kvs-cmd.t: 380: [: 1: unexpected operator Use [ $i -eq 50 ] to compare numbers rather than [ $i == "50" ]. I'm not sure what, if any, effect this actually had on the tests. I seemed to have some intermediate failures that went away after fixing this, so possibly the while loop was exiting on the first iteration, and that worked most of the time. Also, tidy up here documents by replacing << with <<- and indending them.
Reimplement deprecated json-c based API functions in a more standalone way, in terms of newer public interfaces.
Reimplement kvs_get() and type-specific convenience functions in terms of new lookup API. We will phase these into deprecated status later on.
Unwind kvsdir_t details from kvs.c. Make it an opaque type to the rest of the KVS client API implementation. Reimplement using jansson.
Now that all the other "get" functions have been reimplemented, the last user of the internal function getobj() is ks kvs_copy(). Implement it using the new lookup functions and get rid of getobj().
Codecov Report
@@ Coverage Diff @@
## master #1099 +/- ##
=========================================
+ Coverage 78.04% 78.3% +0.26%
=========================================
Files 151 156 +5
Lines 26115 26084 -31
=========================================
+ Hits 20381 20426 +45
+ Misses 5734 5658 -76
|
Changes Unknown when pulling 45022c6 on garlick:kvsapi_cleanup into ** on flux-framework:master**. |
It appears from coverage that some of the kvs_watch functions aren't covered. For the deprecated functions, I wonder if this would be a good point to excise unused code (e.g. Other untested interfaces appear to include |
Good idea excising unused code. Maybe rather than writing tests for the uncovered interfaces that will likely go away, I can switch users over to covered interfaces... |
Good point. Let me know if you need any help with that. |
Drop these functions that have no users: kvs_get_boolean() kvsdir_get_boolean() Update "getas" test driver to drop boolean support
Move test users over to kvs_watch, then drop kvs_watch_int which has no non-test users.
Changes Unknown when pulling 879962a on garlick:kvsapi_cleanup into ** on flux-framework:master**. |
Changes Unknown when pulling 3718a7a on garlick:kvsapi_cleanup into ** on flux-framework:master**. |
This PR divides up the KVS API into separate source files, reimplements some parts in terms of jansson, addresses some exit-on-malloc-failure behavior, and takes a small step towards the API changes proposed in #1094, implementing these lookup functions:
Apart from those new functions, this is mostly cleanup. #1094 goes much further in its proposed changes, but I don't think that design has settled yet, and this PR is big enough it should probably stand alone.
Still todo: man pages for the above functions.