- return pn.inode.Child(name, func(existing inode) (inode, error) {
- if repl, err := replace(existing); err != nil {
- return existing, err
- } else if repl == nil {
- if existing == nil {
- return nil, nil
+
+ var inodes []inode
+
+ // When #17424 is resolved, remove the outer loop here and use
+ // []string{"arvados#collection", "arvados#group"} directly as the uuid
+ // filter.
+ for _, class := range []string{"arvados#collection", "arvados#group"} {
+ // Note: the "filters" slice's backing array might be reused
+ // by append(filters,...) below. This isn't goroutine safe,
+ // but all accesses are in the same goroutine, so it's OK.
+ filters := []Filter{
+ {"uuid", "is_a", class},
+ }
+ if class == "arvados#group" {
+ filters = append(filters, Filter{"group_class", "=", "project"})
+ }
+
+ params := ResourceListParams{
+ Count: "none",
+ Filters: filters,
+ Order: "uuid",
+ }
+
+ for {
+ // The groups content endpoint returns Collection and Group (project)
+ // objects. This function only accesses the UUID and Name field. Both
+ // collections and groups have those fields, so it is easier to just treat
+ // the ObjectList that comes back as a CollectionList.
+ var resp CollectionList
+ err = fs.RequestAndDecode(&resp, "GET", "arvados/v1/groups/"+uuid+"/contents", nil, params)
+ if err != nil {
+ return nil, err