[ARVADOS] updated: 1.3.0-2754-g767f0799f

Git user git at public.arvados.org
Thu Jul 9 14:08:57 UTC 2020


Summary of changes:
 lib/controller/api/routable.go  | 17 +++++++++++++++++
 lib/controller/router/router.go |  9 +++++----
 lib/ctrlctx/db.go               |  6 +++---
 sdk/go/arvados/api.go           |  8 --------
 4 files changed, 25 insertions(+), 15 deletions(-)
 create mode 100644 lib/controller/api/routable.go

       via  767f0799fb430b800920bad0ec83dfa210a51e01 (commit)
      from  21d95b374fc204ae021948e70dd8cce264fda05c (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 767f0799fb430b800920bad0ec83dfa210a51e01
Author: Tom Clegg <tom at tomclegg.ca>
Date:   Thu Jul 9 10:07:59 2020 -0400

    16534: Move RoutableFunc to lib/controller/api.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at tomclegg.ca>

diff --git a/lib/controller/api/routable.go b/lib/controller/api/routable.go
new file mode 100644
index 000000000..6049cba8e
--- /dev/null
+++ b/lib/controller/api/routable.go
@@ -0,0 +1,17 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+// Package api provides types used by controller/server-component
+// packages.
+package api
+
+import "context"
+
+// A RoutableFunc calls an API method (sometimes via a wrapped
+// RoutableFunc) that has real argument types.
+//
+// (It is used by ctrlctx to manage database transactions, so moving
+// it to the router package would cause a circular dependency
+// router->arvadostest->ctrlctx->router.)
+type RoutableFunc func(ctx context.Context, opts interface{}) (interface{}, error)
diff --git a/lib/controller/router/router.go b/lib/controller/router/router.go
index ed638fe7e..294452434 100644
--- a/lib/controller/router/router.go
+++ b/lib/controller/router/router.go
@@ -10,6 +10,7 @@ import (
 	"net/http"
 	"strings"
 
+	"git.arvados.org/arvados.git/lib/controller/api"
 	"git.arvados.org/arvados.git/sdk/go/arvados"
 	"git.arvados.org/arvados.git/sdk/go/auth"
 	"git.arvados.org/arvados.git/sdk/go/ctxlog"
@@ -21,7 +22,7 @@ import (
 type router struct {
 	mux       *mux.Router
 	backend   arvados.API
-	wrapCalls func(arvados.RoutableFunc) arvados.RoutableFunc
+	wrapCalls func(api.RoutableFunc) api.RoutableFunc
 }
 
 // New returns a new router (which implements the http.Handler
@@ -32,7 +33,7 @@ type router struct {
 // the returned method is used in its place. This can be used to
 // install hooks before and after each API call and alter responses;
 // see localdb.WrapCallsInTransaction for an example.
-func New(backend arvados.API, wrapCalls func(arvados.RoutableFunc) arvados.RoutableFunc) *router {
+func New(backend arvados.API, wrapCalls func(api.RoutableFunc) api.RoutableFunc) *router {
 	rtr := &router{
 		mux:       mux.NewRouter(),
 		backend:   backend,
@@ -46,7 +47,7 @@ func (rtr *router) addRoutes() {
 	for _, route := range []struct {
 		endpoint    arvados.APIEndpoint
 		defaultOpts func() interface{}
-		exec        arvados.RoutableFunc
+		exec        api.RoutableFunc
 	}{
 		{
 			arvados.EndpointConfigGet,
@@ -338,7 +339,7 @@ var altMethod = map[string]string{
 	"GET":   "HEAD", // Accept HEAD at any GET route
 }
 
-func (rtr *router) addRoute(endpoint arvados.APIEndpoint, defaultOpts func() interface{}, exec arvados.RoutableFunc) {
+func (rtr *router) addRoute(endpoint arvados.APIEndpoint, defaultOpts func() interface{}, exec api.RoutableFunc) {
 	methods := []string{endpoint.Method}
 	if alt, ok := altMethod[endpoint.Method]; ok {
 		methods = append(methods, alt)
diff --git a/lib/ctrlctx/db.go b/lib/ctrlctx/db.go
index 70e19d7fd..127be489d 100644
--- a/lib/ctrlctx/db.go
+++ b/lib/ctrlctx/db.go
@@ -9,7 +9,7 @@ import (
 	"errors"
 	"sync"
 
-	"git.arvados.org/arvados.git/sdk/go/arvados"
+	"git.arvados.org/arvados.git/lib/controller/api"
 	"git.arvados.org/arvados.git/sdk/go/ctxlog"
 	"github.com/jmoiron/sqlx"
 	_ "github.com/lib/pq"
@@ -26,8 +26,8 @@ var (
 //
 // The wrapper calls getdb() to get a database handle before each API
 // call.
-func WrapCallsInTransactions(getdb func(context.Context) (*sqlx.DB, error)) func(arvados.RoutableFunc) arvados.RoutableFunc {
-	return func(origFunc arvados.RoutableFunc) arvados.RoutableFunc {
+func WrapCallsInTransactions(getdb func(context.Context) (*sqlx.DB, error)) func(api.RoutableFunc) api.RoutableFunc {
+	return func(origFunc api.RoutableFunc) api.RoutableFunc {
 		return func(ctx context.Context, opts interface{}) (_ interface{}, err error) {
 			ctx, finishtx := New(ctx, getdb)
 			defer finishtx(&err)
diff --git a/sdk/go/arvados/api.go b/sdk/go/arvados/api.go
index 295d8137a..c32f88864 100644
--- a/sdk/go/arvados/api.go
+++ b/sdk/go/arvados/api.go
@@ -154,14 +154,6 @@ type LogoutOptions struct {
 	ReturnTo string `json:"return_to"` // Redirect to this URL after logging out
 }
 
-// A RoutableFunc calls an API method (sometimes via a wrapped
-// RoutableFunc) that has real argument types.
-//
-// (It is used by ctrlctx to manage database transactions, so moving
-// it to the router package would cause a circular dependency
-// router->arvadostest->ctrlctx->router.)
-type RoutableFunc func(ctx context.Context, opts interface{}) (interface{}, error)
-
 type API interface {
 	ConfigGet(ctx context.Context) (json.RawMessage, error)
 	Login(ctx context.Context, options LoginOptions) (LoginResponse, error)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list