X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/9ae180ec18f1f397889a4531a12999942edd003a..fc851b249ea25a40a1fb392906705142113ac5b9:/sdk/go/keepclient/support.go diff --git a/sdk/go/keepclient/support.go b/sdk/go/keepclient/support.go index 6393503e96..7b96341823 100644 --- a/sdk/go/keepclient/support.go +++ b/sdk/go/keepclient/support.go @@ -21,6 +21,7 @@ type keepDisk struct { Port int `json:"service_port"` SSL bool `json:"service_ssl_flag"` SvcType string `json:"service_type"` + ReadOnly bool `json:"read_only"` } func Md5String(s string) string { @@ -93,6 +94,7 @@ func (this *KeepClient) DiscoverKeepServers() error { listed := make(map[string]bool) localRoots := make(map[string]string) gatewayRoots := make(map[string]string) + writableLocalRoots := make(map[string]string) for _, service := range m.Items { scheme := "http" @@ -114,6 +116,11 @@ func (this *KeepClient) DiscoverKeepServers() error { localRoots[service.Uuid] = url this.Using_proxy = true } + + if service.ReadOnly == false { + writableLocalRoots[service.Uuid] = url + } + // Gateway services are only used when specified by // UUID, so there's nothing to gain by filtering them // by service type. Including all accessible services @@ -128,7 +135,7 @@ func (this *KeepClient) DiscoverKeepServers() error { this.setClientSettingsStore() } - this.SetServiceRoots(localRoots, gatewayRoots) + this.SetServiceRoots(localRoots, writableLocalRoots, gatewayRoots) return nil } @@ -212,7 +219,7 @@ func (this KeepClient) putReplicas( requestId := fmt.Sprintf("%x", md5.Sum([]byte(locator+time.Now().String())))[0:8] // Calculate the ordering for uploading to servers - sv := NewRootSorter(this.LocalRoots(), hash).GetSortedRoots() + sv := NewRootSorter(this.WritableLocalRoots(), hash).GetSortedRoots() // The next server to try contacting next_server := 0