{"action":"created","issue":{"url":"https://api.github.com/repos/basho/riak_kv/issues/1087","labels_url":"https://api.github.com/repos/basho/riak_kv/issues/1087/labels{/name}","comments_url":"https://api.github.com/repos/basho/riak_kv/issues/1087/comments","events_url":"https://api.github.com/repos/basho/riak_kv/issues/1087/events","html_url":"https://github.com/basho/riak_kv/pull/1087","id":60605055,"number":1087,"title":"DP-6 API entry points coverage, http and pbc API, cached","user":{"login":"hmmr","id":1107079,"avatar_url":"https://avatars.githubusercontent.com/u/1107079?v=3","gravatar_id":"","url":"https://api.github.com/users/hmmr","html_url":"https://github.com/hmmr","followers_url":"https://api.github.com/users/hmmr/followers","following_url":"https://api.github.com/users/hmmr/following{/other_user}","gists_url":"https://api.github.com/users/hmmr/gists{/gist_id}","starred_url":"https://api.github.com/users/hmmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmmr/subscriptions","organizations_url":"https://api.github.com/users/hmmr/orgs","repos_url":"https://api.github.com/users/hmmr/repos","events_url":"https://api.github.com/users/hmmr/events{/privacy}","received_events_url":"https://api.github.com/users/hmmr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-11T03:26:06Z","updated_at":"2015-03-12T19:20:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/basho/riak_kv/pulls/1087","html_url":"https://github.com/basho/riak_kv/pull/1087","diff_url":"https://github.com/basho/riak_kv/pull/1087.diff","patch_url":"https://github.com/basho/riak_kv/pull/1087.patch"},"body":"There are accompanying changes in newly created branches:\r\n\r\n * riak_pb/feature/az/api-entrypoints-coverage, and\r\n * riak_api/feature/az/api-entrypoints-coverage\r\n\r\nthat will have to be merged first.  Python client changes are in\r\n\r\n * riak-python-client/feature/az/api-entrypoints-coverage.\r\n\r\nThe following HTTP requests are accepted (values for parameter P are\r\n\"http\", \"pbc\", assuming the latter by default; for F, values are \"1\"\r\nand \"0\", the latter by default):\r\n\r\n1) /ring/coverage?proto=P&force_update=F\r\n\r\n  returning a JSON like this:\r\n\r\n   {\"struct\":{\"addr\":\"192.168.1.10\",\"port\":10017,\"last_checked\":1426041629},\r\n    \"struct\":...}\r\n\r\nproviding a complete set of API entry points into the cluster via\r\nprotocol P. The value of 'last_checked' is a unixtime of the last\r\nactual call to getifaddrs/0 used to get the bound address.\r\n\r\n2) /ring/coverage/bucket/B/key/K?proto=P&force_update=F\r\n\r\nreturning a similar JSON with details as above.  There will be a\r\nsingle element in the list, in which addr:port is where an entry point\r\nis for shortest data access to the key K in bucket B, via the given\r\nprotocol API.\r\n\r\nOn the first call, or with force_update=1, results are cached in\r\ncluster metadata.  There is no expiry period; clients finding their\r\nconnections dropped should re-request interesting entry points with\r\nforce_update=1.\r\n\r\nHTTP responses are further cached on their own, until the next\r\nmultiple of (a default of) 15 secs, configurable via parameter\r\n'ring_coverage_cache_expiry_time'.\r\n\r\nFor pb, two new messages are provided:\r\n\r\n RpbApiEpReq (code 90),\r\n RpbApiEpResp(code 91).\r\n\r\ndeclared in riak_pb/src/riak_kv.proto.\r\n\r\nThe coverage information is obtained in two steps:\r\n\r\n1. using riak_core_apl:get_apl_ann(), get active preflist for given\r\n   Bucket and Key, and extract riak nodes from it;\r\n\r\n2. make an rpc call on those nodes to:\r\n\r\n   (a) determine which of the relevant listener apps (i.e., riak_api_pb_listener,\r\n       riak_api_web) are running on those nodes,\r\n       and find the ports these are listening on.\r\n\r\n   (b) get the bound ip address of the first non-loopback interface on the\r\n       underlying os (all code is in riak_api/src/riak_api_lib.erl).\r\n\r\nThe corresponding new riak python client method is:\r\n\r\n* client.get_api_entry_points(bucket, key, proto = 'pbc', force_update = False)\r\n\r\nwhere bucket and key can be None to request the complete map."},"comment":{"url":"https://api.github.com/repos/basho/riak_kv/issues/comments/78578863","html_url":"https://github.com/basho/riak_kv/pull/1087#issuecomment-78578863","issue_url":"https://api.github.com/repos/basho/riak_kv/issues/1087","id":78578863,"user":{"login":"hmmr","id":1107079,"avatar_url":"https://avatars.githubusercontent.com/u/1107079?v=3","gravatar_id":"","url":"https://api.github.com/users/hmmr","html_url":"https://github.com/hmmr","followers_url":"https://api.github.com/users/hmmr/followers","following_url":"https://api.github.com/users/hmmr/following{/other_user}","gists_url":"https://api.github.com/users/hmmr/gists{/gist_id}","starred_url":"https://api.github.com/users/hmmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmmr/subscriptions","organizations_url":"https://api.github.com/users/hmmr/orgs","repos_url":"https://api.github.com/users/hmmr/repos","events_url":"https://api.github.com/users/hmmr/events{/privacy}","received_events_url":"https://api.github.com/users/hmmr/received_events","type":"User","site_admin":false},"created_at":"2015-03-12T19:20:40Z","updated_at":"2015-03-12T19:20:40Z","body":"@seancribbs At this point, it looks to me good enough for the next round of review. The two PRs dependent on this one are https://github.com/basho/riak_pb/pull/106 and https://github.com/basho/riak_api/pull/84. Then, there is a PR in https://github.com/basho/riak_api/pull/84."}}