3198: Support for truncating files. A few tests. Next step work on random access...
[arvados.git] / sdk / go / keepclient / support.go
index e51dcb3c097369ffc20cd2fe8ca3e0572817c984..e12214450c12527f9e447d77025df0d542cb208d 100644 (file)
@@ -2,6 +2,7 @@
 package keepclient
 
 import (
+       "crypto/md5"
        "git.curoverse.com/arvados.git/sdk/go/streamer"
        "errors"
        "fmt"
@@ -21,6 +22,10 @@ type keepDisk struct {
        SvcType  string `json:"service_type"`
 }
 
+func Md5String(s string) (string) {
+       return fmt.Sprintf("%x", md5.Sum([]byte(s)))
+}
+
 func (this *KeepClient) DiscoverKeepServers() error {
        if prx := os.Getenv("ARVADOS_KEEP_PROXY"); prx != "" {
                sr := map[string]string{"proxy":prx}
@@ -70,10 +75,6 @@ func (this *KeepClient) DiscoverKeepServers() error {
        return nil
 }
 
-func (this KeepClient) shuffledServiceRoots(hash string) (pseq []string) {
-       return NewRootSorter(this.ServiceRoots(), hash).GetSortedRoots()
-}
-
 type uploadStatus struct {
        err             error
        url             string