1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
11 "git.arvados.org/arvados.git/lib/service"
12 "git.arvados.org/arvados.git/sdk/go/arvados"
13 "github.com/prometheus/client_golang/prometheus"
17 Command = service.Command(arvados.ServiceNameKeepstore, newHandlerOrErrorHandler)
20 func newHandlerOrErrorHandler(ctx context.Context, cluster *arvados.Cluster, token string, reg *prometheus.Registry) service.Handler {
21 serviceURL, ok := service.URLFromContext(ctx)
23 return service.ErrorHandler(ctx, cluster, errors.New("BUG: no URL from service.URLFromContext"))
25 ks, err := newKeepstore(ctx, cluster, token, reg, serviceURL)
27 return service.ErrorHandler(ctx, cluster, err)
29 puller := newPuller(ctx, ks, reg)
30 trasher := newTrasher(ctx, ks, reg)
31 _ = newTrashEmptier(ctx, ks, reg)
32 return newRouter(ks, puller, trasher)