[ARVADOS] updated: 2.1.0-444-g708fe50ee

Git user git at public.arvados.org
Wed Feb 24 21:34:49 UTC 2021


Summary of changes:
 sdk/go/arvados/fs_project.go | 45 +++++++++++++++++---------------------------
 1 file changed, 17 insertions(+), 28 deletions(-)

       via  708fe50ee0c164ca2246389dacdd863f70bd10bf (commit)
      from  a439d4d3228cae6f2d518c24d1d58a259142e5cd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 708fe50ee0c164ca2246389dacdd863f70bd10bf
Author: Ward Vandewege <ward at curii.com>
Date:   Wed Feb 24 16:34:05 2021 -0500

    17119: make customFileSystem use the group contents endpoint.
    
    Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>

diff --git a/sdk/go/arvados/fs_project.go b/sdk/go/arvados/fs_project.go
index bf6391a74..ef3b16df8 100644
--- a/sdk/go/arvados/fs_project.go
+++ b/sdk/go/arvados/fs_project.go
@@ -83,15 +83,24 @@ func (fs *customFileSystem) projectsLoadAll(parent inode, uuid string) ([]inode,
 	// 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{{"owner_uuid", "=", uuid}}
+	filters := []Filter{
+		{"uuid", "is_a", []string{"arvados#collection", "arvados#group"}},
+		{"groups.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/collections", nil, params)
+		err = fs.RequestAndDecode(&resp, "GET", "arvados/v1/groups/"+uuid+"/contents", nil, params)
 		if err != nil {
 			return nil, err
 		}
@@ -99,37 +108,17 @@ func (fs *customFileSystem) projectsLoadAll(parent inode, uuid string) ([]inode,
 			break
 		}
 		for _, i := range resp.Items {
-			coll := i
 			if fs.forwardSlashNameSubstitution != "" {
-				coll.Name = strings.Replace(coll.Name, "/", fs.forwardSlashNameSubstitution, -1)
+				i.Name = strings.Replace(i.Name, "/", fs.forwardSlashNameSubstitution, -1)
 			}
-			if !permittedName(coll.Name) {
+			if !permittedName(i.Name) {
 				continue
 			}
-			inodes = append(inodes, deferredCollectionFS(fs, parent, coll))
-		}
-		params.Filters = append(filters, Filter{"uuid", ">", resp.Items[len(resp.Items)-1].UUID})
-	}
-
-	filters = append(filters, Filter{"group_class", "=", "project"})
-	params.Filters = filters
-	for {
-		var resp GroupList
-		err = fs.RequestAndDecode(&resp, "GET", "arvados/v1/groups", nil, params)
-		if err != nil {
-			return nil, err
-		}
-		if len(resp.Items) == 0 {
-			break
-		}
-		for _, group := range resp.Items {
-			if fs.forwardSlashNameSubstitution != "" {
-				group.Name = strings.Replace(group.Name, "/", fs.forwardSlashNameSubstitution, -1)
-			}
-			if !permittedName(group.Name) {
-				continue
+			if strings.Contains(i.UUID, "-j7d0g-") {
+				inodes = append(inodes, fs.newProjectNode(parent, i.Name, i.UUID))
+			} else {
+				inodes = append(inodes, deferredCollectionFS(fs, parent, i))
 			}
-			inodes = append(inodes, fs.newProjectNode(parent, group.Name, group.UUID))
 		}
 		params.Filters = append(filters, Filter{"uuid", ">", resp.Items[len(resp.Items)-1].UUID})
 	}

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list