17702: Move check for ClusterID into splitListRequest
authorPeter Amstutz <peter.amstutz@curii.com>
Mon, 24 May 2021 15:14:37 +0000 (11:14 -0400)
committerPeter Amstutz <peter.amstutz@curii.com>
Mon, 24 May 2021 15:14:37 +0000 (11:14 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz@curii.com>

lib/controller/federation/generated.go
lib/controller/federation/list.go

index 3ede1f1154900256bcda9e589013fafe1e30e52a..49a2e5b7513f537f0f129fac6c8ba81103e72a29 100755 (executable)
@@ -18,12 +18,6 @@ import (
 //
 
 func (conn *Conn) generated_ContainerList(ctx context.Context, options arvados.ListOptions) (arvados.ContainerList, error) {
-       if options.ClusterID != "" {
-               // explicitly selected cluster
-               options.ForwardedFor = conn.cluster.ClusterID + "-" + options.ForwardedFor
-               return conn.chooseBackend(options.ClusterID).ContainerList(ctx, options)
-       }
-
        var mtx sync.Mutex
        var merged arvados.ContainerList
        var needSort atomic.Value
@@ -65,12 +59,6 @@ func (conn *Conn) generated_ContainerList(ctx context.Context, options arvados.L
 }
 
 func (conn *Conn) generated_ContainerRequestList(ctx context.Context, options arvados.ListOptions) (arvados.ContainerRequestList, error) {
-       if options.ClusterID != "" {
-               // explicitly selected cluster
-               options.ForwardedFor = conn.cluster.ClusterID + "-" + options.ForwardedFor
-               return conn.chooseBackend(options.ClusterID).ContainerRequestList(ctx, options)
-       }
-
        var mtx sync.Mutex
        var merged arvados.ContainerRequestList
        var needSort atomic.Value
@@ -112,12 +100,6 @@ func (conn *Conn) generated_ContainerRequestList(ctx context.Context, options ar
 }
 
 func (conn *Conn) generated_GroupList(ctx context.Context, options arvados.ListOptions) (arvados.GroupList, error) {
-       if options.ClusterID != "" {
-               // explicitly selected cluster
-               options.ForwardedFor = conn.cluster.ClusterID + "-" + options.ForwardedFor
-               return conn.chooseBackend(options.ClusterID).GroupList(ctx, options)
-       }
-
        var mtx sync.Mutex
        var merged arvados.GroupList
        var needSort atomic.Value
@@ -159,12 +141,6 @@ func (conn *Conn) generated_GroupList(ctx context.Context, options arvados.ListO
 }
 
 func (conn *Conn) generated_SpecimenList(ctx context.Context, options arvados.ListOptions) (arvados.SpecimenList, error) {
-       if options.ClusterID != "" {
-               // explicitly selected cluster
-               options.ForwardedFor = conn.cluster.ClusterID + "-" + options.ForwardedFor
-               return conn.chooseBackend(options.ClusterID).SpecimenList(ctx, options)
-       }
-
        var mtx sync.Mutex
        var merged arvados.SpecimenList
        var needSort atomic.Value
@@ -206,12 +182,6 @@ func (conn *Conn) generated_SpecimenList(ctx context.Context, options arvados.Li
 }
 
 func (conn *Conn) generated_UserList(ctx context.Context, options arvados.ListOptions) (arvados.UserList, error) {
-       if options.ClusterID != "" {
-               // explicitly selected cluster
-               options.ForwardedFor = conn.cluster.ClusterID + "-" + options.ForwardedFor
-               return conn.chooseBackend(options.ClusterID).UserList(ctx, options)
-       }
-
        var mtx sync.Mutex
        var merged arvados.UserList
        var needSort atomic.Value
index a9ac03ee5d2ecadaaccd064e5ee133093aadd6bc..039caac574e479bdad181dfeed745dd3255640cf 100644 (file)
@@ -22,12 +22,6 @@ import (
 // methods for other types; see generate.go.
 
 func (conn *Conn) generated_CollectionList(ctx context.Context, options arvados.ListOptions) (arvados.CollectionList, error) {
-       if options.ClusterID != "" {
-               // explicitly selected cluster
-               options.ForwardedFor = conn.cluster.ClusterID + "-" + options.ForwardedFor
-               return conn.chooseBackend(options.ClusterID).CollectionList(ctx, options)
-       }
-
        var mtx sync.Mutex
        var merged arvados.CollectionList
        var needSort atomic.Value
@@ -119,6 +113,11 @@ func (conn *Conn) splitListRequest(ctx context.Context, opts arvados.ListOptions
                _, err := fn(ctx, conn.cluster.ClusterID, conn.local, opts)
                return err
        }
+       if opts.ClusterID != "" {
+               // Client explicitly selected cluster
+               _, err := fn(ctx, conn.cluster.ClusterID, conn.chooseBackend(opts.ClusterID), opts)
+               return err
+       }
 
        cannotSplit := false
        var matchAllFilters map[string]bool