1 /* Keep Datamanager. Responsible for checking on and reporting on Keep Storage */
6 //"git.curoverse.com/arvados.git/sdk/go/keepclient"
8 "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
9 "git.curoverse.com/arvados.git/services/datamanager/collection"
13 // Helper type so we don't have to write out 'map[string]interface{}' every time.
14 type Dict map[string]interface{}
16 func UserIsAdmin(arv arvadosclient.ArvadosClient) (is_admin bool, err error) {
18 IsAdmin bool `json:"is_admin"`
21 err = arv.Call("GET", "users", "", "current", nil, &u)
26 fmt.Println("Hello, world\n")
28 arv, err := arvadosclient.MakeArvadosClient()
30 log.Fatalf("Error setting up arvados client %s", err.Error())
33 if is_admin, err := UserIsAdmin(arv); err != nil {
34 log.Fatalf("Error querying current arvados user %s", err.Error())
36 log.Fatalf("Current user is not an admin. Datamanager can only be run by admins.")
39 readCollections := collection.GetCollections(
40 collection.GetCollectionsParams{
41 Client: arv, Limit: 50, LogEveryNthCollectionProcessed: 10})
43 //log.Printf("Read Collections: %v", readCollections)
45 // TODO(misha): Add a "readonly" flag. If we're in readonly mode,
46 // lots of behaviors can become warnings (and obviously we can't
48 // if !readCollections.ReadAllCollections {
49 // log.Fatalf("Did not read all collections")
52 log.Printf("Read and processed %d collections",
53 len(readCollections.UuidToCollection))
55 // TODO(misha): Send SDK and Keep requests in parallel