5414: Add client support for Keep service hints.
authorTom Clegg <tom@curoverse.com>
Sun, 29 Mar 2015 00:26:00 +0000 (20:26 -0400)
committerTom Clegg <tom@curoverse.com>
Wed, 8 Apr 2015 15:45:38 +0000 (11:45 -0400)
commit9ae180ec18f1f397889a4531a12999942edd003a
tree953b032f294dc99d1e46b2eb0653e1c189e55ae9
parente009f03d9f3a620f375cf187291bd12c2bf1d74c
5414: Add client support for Keep service hints.

Also, some incidental improvements in nearby code:

* Consistent logging in keepproxy, with one reusable logging statement
  instead of a different statement/format for each outcome.

* In sdk/go/keepclient, remove public AuthorizedGet and AuthorizedAsk
  methods. Instead, Get() and Ask() accept a locator (with or without
  a permission token) and do the right thing. Callers don't have to
  parse locators to decide which method to call.

* In sdk/go/keepclient, use an RWMutex instead of atomic.LoadPointer()
  and unsafe.Pointer() to update KeepClient root maps safely.

* In sdk/go/keepclient, DiscoverKeepServers() doesn't return the new
  root maps, just an error. In normal usage, the caller only cares
  whether discovery was successful.

Also, some Go style fixes in nearby code:

* Use pointer receivers for all KeepClient methods.
  https://golang.org/doc/faq#methods_on_values_or_pointers

* Use receiver name "kc", not "this".
  https://github.com/golang/go/wiki/CodeReviewComments#receiver-names

* Handle errors first, use minimal indentation for normal code path.
  https://github.com/golang/go/wiki/CodeReviewComments#indent-error-flow
12 files changed:
sdk/go/keepclient/keepclient.go
sdk/go/keepclient/keepclient_test.go
sdk/go/keepclient/support.go
sdk/python/arvados/keep.py
sdk/python/tests/arvados_testutil.py
sdk/python/tests/test_keep_client.py
services/keepproxy/keepproxy.go
services/keepproxy/keepproxy_test.go
services/keepstore/keepstore.go
services/keepstore/pull_worker.go
services/keepstore/pull_worker_integration_test.go
services/keepstore/pull_worker_test.go