From 206c75c140d796d74e1672f3089861036596e0c0 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Tue, 25 Jun 2019 14:10:19 -0400 Subject: [PATCH] 14287: Support federated requests for /used_by and /provenance. Arvados-DCO-1.1-Signed-off-by: Tom Clegg --- lib/controller/federation/conn.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/controller/federation/conn.go b/lib/controller/federation/conn.go index 2d84db4df9..e094953fc4 100644 --- a/lib/controller/federation/conn.go +++ b/lib/controller/federation/conn.go @@ -88,8 +88,11 @@ func saltedTokenProvider(local backend, remoteID string) rpc.TokenProvider { // Return suitable backend for a query about the given cluster ID // ("aaaaa") or object UUID ("aaaaa-dz642-abcdefghijklmno"). func (conn *Conn) chooseBackend(id string) backend { - if len(id) > 5 { + if len(id) == 27 { id = id[:5] + } else if len(id) != 5 { + // PDH or bogus ID + return conn.local } if id == conn.cluster.ClusterID { return conn.local @@ -220,11 +223,11 @@ func (conn *Conn) CollectionList(ctx context.Context, options arvados.ListOption } func (conn *Conn) CollectionProvenance(ctx context.Context, options arvados.GetOptions) (map[string]interface{}, error) { - return conn.local.CollectionProvenance(ctx, options) + return conn.chooseBackend(options.UUID).CollectionProvenance(ctx, options) } func (conn *Conn) CollectionUsedBy(ctx context.Context, options arvados.GetOptions) (map[string]interface{}, error) { - return conn.local.CollectionUsedBy(ctx, options) + return conn.chooseBackend(options.UUID).CollectionUsedBy(ctx, options) } func (conn *Conn) CollectionDelete(ctx context.Context, options arvados.DeleteOptions) (arvados.Collection, error) { -- 2.30.2