X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c5db21f4d720e931ed7bff0c5da53caf0cafd2f4..47e42f1129363c2565e69c36ff26ce9c42731fb8:/sdk/go/keepclient/keepclient.go diff --git a/sdk/go/keepclient/keepclient.go b/sdk/go/keepclient/keepclient.go index 2f809b3256..58f3ffb834 100644 --- a/sdk/go/keepclient/keepclient.go +++ b/sdk/go/keepclient/keepclient.go @@ -11,7 +11,6 @@ import ( "git.curoverse.com/arvados.git/sdk/go/streamer" "io" "io/ioutil" - "log" "net/http" "regexp" "strconv" @@ -68,7 +67,6 @@ const X_Keep_Replicas_Stored = "X-Keep-Replicas-Stored" type KeepClient struct { Arvados *arvadosclient.ArvadosClient Want_replicas int - Using_proxy bool localRoots *map[string]string writableLocalRoots *map[string]string gatewayRoots *map[string]string @@ -78,6 +76,9 @@ type KeepClient struct { // set to 1 if all writable services are of disk type, otherwise 0 replicasPerService int + + // Any non-disk typed services found in the list of keepservers? + foundNonDiskSvc bool } // MakeKeepClient creates a new KeepClient by contacting the API server to discover Keep servers. @@ -101,7 +102,6 @@ func New(arv *arvadosclient.ArvadosClient) *KeepClient { kc := &KeepClient{ Arvados: arv, Want_replicas: defaultReplicationLevel, - Using_proxy: false, Client: &http.Client{Transport: &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: arv.ApiInsecure}}}, Retries: 2, @@ -200,7 +200,7 @@ func (kc *KeepClient) getOrHead(method string, locator string) (io.ReadCloser, i retryList = append(retryList, host) } else if resp.StatusCode != http.StatusOK { var respbody []byte - respbody, _ = ioutil.ReadAll(&io.LimitedReader{resp.Body, 4096}) + respbody, _ = ioutil.ReadAll(&io.LimitedReader{R: resp.Body, N: 4096}) resp.Body.Close() errs = append(errs, fmt.Sprintf("%s: HTTP %d %q", url, resp.StatusCode, bytes.TrimSpace(respbody))) @@ -232,7 +232,7 @@ func (kc *KeepClient) getOrHead(method string, locator string) (io.ReadCloser, i } serversToTry = retryList } - log.Printf("DEBUG: %s %s failed: %v", method, locator, errs) + DebugPrintf("DEBUG: %s %s failed: %v", method, locator, errs) var err error if count404 == numServers { @@ -352,7 +352,7 @@ func (kc *KeepClient) WritableLocalRoots() map[string]string { // caller can reuse/modify them after SetServiceRoots returns, but // they should not be modified by any other goroutine while // SetServiceRoots is running. -func (kc *KeepClient) SetServiceRoots(newLocals, newWritableLocals map[string]string, newGateways map[string]string) { +func (kc *KeepClient) SetServiceRoots(newLocals, newWritableLocals, newGateways map[string]string) { locals := make(map[string]string) for uuid, root := range newLocals { locals[uuid] = root