{"action":"created","issue":{"url":"https://api.github.com/repos/flux-framework/flux-core/issues/801","repository_url":"https://api.github.com/repos/flux-framework/flux-core","labels_url":"https://api.github.com/repos/flux-framework/flux-core/issues/801/labels{/name}","comments_url":"https://api.github.com/repos/flux-framework/flux-core/issues/801/comments","events_url":"https://api.github.com/repos/flux-framework/flux-core/issues/801/events","html_url":"https://github.com/flux-framework/flux-core/pull/801","id":175898253,"number":801,"title":"add KVS blobref access functions","user":{"login":"garlick","id":169947,"avatar_url":"https://avatars.githubusercontent.com/u/169947?v=3","gravatar_id":"","url":"https://api.github.com/users/garlick","html_url":"https://github.com/garlick","followers_url":"https://api.github.com/users/garlick/followers","following_url":"https://api.github.com/users/garlick/following{/other_user}","gists_url":"https://api.github.com/users/garlick/gists{/gist_id}","starred_url":"https://api.github.com/users/garlick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garlick/subscriptions","organizations_url":"https://api.github.com/users/garlick/orgs","repos_url":"https://api.github.com/users/garlick/repos","events_url":"https://api.github.com/users/garlick/events{/privacy}","received_events_url":"https://api.github.com/users/garlick/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/flux-framework/flux-core/labels/review","name":"review","color":"ededed"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-09-09T00:29:42Z","updated_at":"2016-09-09T03:34:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/flux-framework/flux-core/pulls/801","html_url":"https://github.com/flux-framework/flux-core/pull/801","diff_url":"https://github.com/flux-framework/flux-core/pull/801.diff","patch_url":"https://github.com/flux-framework/flux-core/pull/801.patch"},"body":"This PR implements the KVS functions suggested in issue #778 for accessing the blobref of a key, and for creating a key with a blobref in place of a value.  The new functions are\r\n\r\n```C\r\n/* Get blobref associated with a key.  Caller must free.\r\n * If value is stored \"by value\", return EINVAL.\r\n */\r\nint kvs_get_value_blobref (flux_t h, const char *key, char **blobref);\r\nint kvs_get_directory_blobref (flux_t h, const char *key, char **blobref);\r\n\r\n/* Create a reference to a value/directory object stored in content cache.\r\n */\r\nint kvs_put_value_blobref (flux_t h, const char *key, const char *blobref);\r\nint kvs_put_directory_blobref (flux_t h, const char *key, const char *blobref);\r\n```\r\n\r\nIn addition the kvs.get and kvs.commit protocols were cleaned up, switching from a dictionary with  a plethora of boolean flags to JSON requests more like those used in other parts of Flux, and an integer flags mask.  And the client side \"get\" variants were refactor a little to reduce duplication.\r\n\r\nCommands were added for testing the new functions.  Here's a command to create a root snapshot\r\n```\r\n$ flux kvs put-blobref -d root-snapshot-1 `flux kvs get-blobref -d .`\r\n$ flux kvs dir \r\nresource.\r\nroot-snapshot-1.\r\n$\r\n```\r\n\r\nFinally `kvs_copy()` was modified to link blobrefs rather than recursively copy entire directory hierarchies.  (`kvs_move()` is implemented on `kvs_copy()` so it benefits too).\r\n\r\nI still need to add some tests here."},"comment":{"url":"https://api.github.com/repos/flux-framework/flux-core/issues/comments/245810016","html_url":"https://github.com/flux-framework/flux-core/pull/801#issuecomment-245810016","issue_url":"https://api.github.com/repos/flux-framework/flux-core/issues/801","id":245810016,"user":{"login":"garlick","id":169947,"avatar_url":"https://avatars.githubusercontent.com/u/169947?v=3","gravatar_id":"","url":"https://api.github.com/users/garlick","html_url":"https://github.com/garlick","followers_url":"https://api.github.com/users/garlick/followers","following_url":"https://api.github.com/users/garlick/following{/other_user}","gists_url":"https://api.github.com/users/garlick/gists{/gist_id}","starred_url":"https://api.github.com/users/garlick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garlick/subscriptions","organizations_url":"https://api.github.com/users/garlick/orgs","repos_url":"https://api.github.com/users/garlick/repos","events_url":"https://api.github.com/users/garlick/events{/privacy}","received_events_url":"https://api.github.com/users/garlick/received_events","type":"User","site_admin":false},"created_at":"2016-09-09T03:34:17Z","updated_at":"2016-09-09T03:34:17Z","body":"Put needs the two variants (or it could easily be one function with flags) so that we don't have to try to parse every blob to decide if it's a directory or not.  _Its_ directory entry needs to tag it as a value or a directory, so we need to know that.\r\n\r\nIt's less clear with get, but I didn't want to make it easy for someone to do a get on a key that they thought was a directory, inadvertantly get a value, and then assign it to a directory.\r\n\r\nWhich gets right to one of my concerns about this PR, which is we're allowing \"users\" direct access to the metadata, thus we now have to be concerned about making the kvs module robust enough to not crash if random data is assingned to a directory.  I'll try to add some tests for that."}}
{"actor":{"display_login":"garlick"}}