1 /* Keep Datamanager. Responsible for checking on and reporting on Keep Storage */
6 //"git.curoverse.com/arvados.git/sdk/go/keepclient"
7 "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
8 "git.curoverse.com/arvados.git/sdk/go/util"
9 "git.curoverse.com/arvados.git/services/datamanager/collection"
10 "git.curoverse.com/arvados.git/services/datamanager/keep"
14 // Helper type so we don't have to write out 'map[string]interface{}' every time.
15 type Dict map[string]interface{}
18 arv, err := arvadosclient.MakeArvadosClient()
20 log.Fatalf("Error setting up arvados client %s", err.Error())
23 if is_admin, err := util.UserIsAdmin(arv); err != nil {
24 log.Fatalf("Error querying current arvados user %s", err.Error())
26 log.Fatalf("Current user is not an admin. Datamanager can only be run by admins.")
29 readCollections := collection.GetCollections(
30 collection.GetCollectionsParams{
31 Client: arv, Limit: 50, LogEveryNthCollectionProcessed: 10})
33 //log.Printf("Read Collections: %v", readCollections)
35 // TODO(misha): Add a "readonly" flag. If we're in readonly mode,
36 // lots of behaviors can become warnings (and obviously we can't
38 // if !readCollections.ReadAllCollections {
39 // log.Fatalf("Did not read all collections")
42 log.Printf("Read and processed %d collections",
43 len(readCollections.UuidToCollection))
45 readServers := keep.GetKeepServers(
46 keep.GetKeepServersParams{Client: arv, Limit: 1000})
48 log.Printf("Returned %d keep disks", len(readServers.AddressToContents))