"git.arvados.org/arvados.git/sdk/go/arvadosclient"
)
-// Function used to emit debug messages. The easiest way to enable
+// DebugPrintf emits debug messages. The easiest way to enable
// keepclient debug messages in your application is to assign
// log.Printf to DebugPrintf.
var DebugPrintf = func(string, ...interface{}) {}
req.Header.Add("X-Request-Id", reqid)
req.Header.Add("Authorization", "OAuth2 "+this.Arvados.ApiToken)
req.Header.Add("Content-Type", "application/octet-stream")
- req.Header.Add(X_Keep_Desired_Replicas, fmt.Sprint(this.Want_replicas))
+ req.Header.Add(XKeepDesiredReplicas, fmt.Sprint(this.Want_replicas))
if len(this.StorageClasses) > 0 {
req.Header.Add("X-Keep-Storage-Classes", strings.Join(this.StorageClasses, ", "))
}
}
rep := 1
- if xr := resp.Header.Get(X_Keep_Replicas_Stored); xr != "" {
+ if xr := resp.Header.Get(XKeepReplicasStored); xr != "" {
fmt.Sscanf(xr, "%d", &rep)
}
lastError := make(map[string]string)
for retriesRemaining > 0 {
- retriesRemaining -= 1
+ retriesRemaining--
nextServer = 0
retryServers = []string{}
for replicasTodo > 0 {
if nextServer < len(sv) {
DebugPrintf("DEBUG: [%s] Begin upload %s to %s", reqid, hash, sv[nextServer])
go this.uploadToKeepServer(sv[nextServer], hash, getReader(), uploadStatusChan, expectedLength, reqid)
- nextServer += 1
- active += 1
+ nextServer++
+ active++
} else {
if active == 0 && retriesRemaining == 0 {
msg := "Could not write sufficient replicas: "
// Now wait for something to happen.
if active > 0 {
status := <-uploadStatusChan
- active -= 1
+ active--
if status.statusCode == 200 {
// good news!