X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a2b994f10fd73bdd882e691854239fc2d3b2e3a0..6a9804cbbc7e73a3ccea577150374322218c3fd7:/lib/ctrlctx/db.go diff --git a/lib/ctrlctx/db.go b/lib/ctrlctx/db.go index e8d9248ffc..36d79d3d2e 100644 --- a/lib/ctrlctx/db.go +++ b/lib/ctrlctx/db.go @@ -9,9 +9,10 @@ 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" + // sqlx needs lib/pq to talk to PostgreSQL _ "github.com/lib/pq" ) @@ -26,8 +27,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) @@ -66,7 +67,7 @@ type finishFunc func(*error) // commit or rollback the transaction, if any. // // func example(ctx context.Context) (err error) { -// ctx, finishtx := NewContext(ctx, dber) +// ctx, finishtx := New(ctx, dber) // defer finishtx(&err) // // ... // tx, err := CurrentTx(ctx)