{"action":"created","issue":{"url":"https://api.github.com/repos/docker/libkv/issues/48","labels_url":"https://api.github.com/repos/docker/libkv/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/docker/libkv/issues/48/comments","events_url":"https://api.github.com/repos/docker/libkv/issues/48/events","html_url":"https://github.com/docker/libkv/issues/48","id":104520054,"number":48,"title":"Normalize values across backends","user":{"login":"colebrumley","id":5015139,"avatar_url":"https://avatars.githubusercontent.com/u/5015139?v=3","gravatar_id":"","url":"https://api.github.com/users/colebrumley","html_url":"https://github.com/colebrumley","followers_url":"https://api.github.com/users/colebrumley/followers","following_url":"https://api.github.com/users/colebrumley/following{/other_user}","gists_url":"https://api.github.com/users/colebrumley/gists{/gist_id}","starred_url":"https://api.github.com/users/colebrumley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colebrumley/subscriptions","organizations_url":"https://api.github.com/users/colebrumley/orgs","repos_url":"https://api.github.com/users/colebrumley/repos","events_url":"https://api.github.com/users/colebrumley/events{/privacy}","received_events_url":"https://api.github.com/users/colebrumley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-02T16:22:45Z","updated_at":"2015-09-02T20:26:28Z","closed_at":null,"body":"I noticed that the backend drivers for etcd and consul (haven't looked at ZK or Bolt) behave differently with regard to key values on puts.  Since Consul base64 encodes key values by default and etcd doesn't, etcd key values cannot contain many special characters.  This defeats the purpose of an abstraction layer IMO, since as it stands now a user needs to write different code to use libkv with different backends.\r\n\r\nI propose that libkv should normalize value inputs so that all backends behave identically.  If there's extra processing that needs to be done to accommodate different backends, libkv should do that on behalf of the client.  Either escaping unusable characters or b64 encoding the whole value on backends that don't do this automatically are my first thoughts, but I'm sure there are plenty of others.\r\n\r\nThe flip side of my argument is that normalized values for some backends would no longer be plaintext to non-libkv clients, which could cause trouble for some use cases.  I still think this is preferable to the raw values that libkv uses now.  Perhaps there could be a boolean 'sanitize' toggle in `libkv.NewStore()` to maintain backwards compatibility?\r\n\r\nJust wanted to drop this here to get opinions.  If it makes sense and would be accepted, I'll write it up and do a PR."},"comment":{"url":"https://api.github.com/repos/docker/libkv/issues/comments/137233969","html_url":"https://github.com/docker/libkv/issues/48#issuecomment-137233969","issue_url":"https://api.github.com/repos/docker/libkv/issues/48","id":137233969,"user":{"login":"colebrumley","id":5015139,"avatar_url":"https://avatars.githubusercontent.com/u/5015139?v=3","gravatar_id":"","url":"https://api.github.com/users/colebrumley","html_url":"https://github.com/colebrumley","followers_url":"https://api.github.com/users/colebrumley/followers","following_url":"https://api.github.com/users/colebrumley/following{/other_user}","gists_url":"https://api.github.com/users/colebrumley/gists{/gist_id}","starred_url":"https://api.github.com/users/colebrumley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colebrumley/subscriptions","organizations_url":"https://api.github.com/users/colebrumley/orgs","repos_url":"https://api.github.com/users/colebrumley/repos","events_url":"https://api.github.com/users/colebrumley/events{/privacy}","received_events_url":"https://api.github.com/users/colebrumley/received_events","type":"User","site_admin":false},"created_at":"2015-09-02T20:26:28Z","updated_at":"2015-09-02T20:26:28Z","body":"Thanks @abronan, that's seems perfectly cromulent to me.  In terms of the general approach going forward, is libkv going to stick with the _least exhaustive_ model, or will there eventually be a minimal feature set required of backend drivers?\r\n\r\nFeel free to close this issue if you'd like, thanks for the answers!"}}