diff --git a/services/proxy/pkg/command/server.go b/services/proxy/pkg/command/server.go index 095455b6f..7cd82c96a 100644 --- a/services/proxy/pkg/command/server.go +++ b/services/proxy/pkg/command/server.go @@ -8,6 +8,7 @@ import ( "time" "github.com/coreos/go-oidc/v3/oidc" + "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" "github.com/cs3org/reva/v2/pkg/token/manager/jwt" chimiddleware "github.com/go-chi/chi/v5/middleware" "github.com/justinas/alice" @@ -21,7 +22,6 @@ import ( storesvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/store/v0" "github.com/owncloud/ocis/v2/services/proxy/pkg/config" "github.com/owncloud/ocis/v2/services/proxy/pkg/config/parser" - "github.com/owncloud/ocis/v2/services/proxy/pkg/cs3" "github.com/owncloud/ocis/v2/services/proxy/pkg/logging" "github.com/owncloud/ocis/v2/services/proxy/pkg/metrics" "github.com/owncloud/ocis/v2/services/proxy/pkg/middleware" @@ -128,7 +128,7 @@ func Server(cfg *config.Config) *cli.Command { func loadMiddlewares(ctx context.Context, logger log.Logger, cfg *config.Config) alice.Chain { rolesClient := settingssvc.NewRoleService("com.owncloud.api.settings", grpc.DefaultClient()) - revaClient, err := cs3.GetGatewayServiceClient(cfg.Reva.Address) + revaClient, err := pool.GetGatewayServiceClient(cfg.Reva.Address) var userProvider backend.UserBackend switch cfg.AccountBackend { case "cs3": diff --git a/services/proxy/pkg/cs3/client.go b/services/proxy/pkg/cs3/client.go deleted file mode 100644 index bbc4dcc3d..000000000 --- a/services/proxy/pkg/cs3/client.go +++ /dev/null @@ -1,39 +0,0 @@ -package cs3 - -import ( - gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1" - proxytracing "github.com/owncloud/ocis/v2/services/proxy/pkg/tracing" - "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" -) - -func newConn(endpoint string) (*grpc.ClientConn, error) { - conn, err := grpc.Dial( - endpoint, - grpc.WithTransportCredentials(insecure.NewCredentials()), - grpc.WithUnaryInterceptor( - otelgrpc.UnaryClientInterceptor( - otelgrpc.WithTracerProvider( - proxytracing.TraceProvider, - ), - ), - ), - ) - if err != nil { - return nil, err - } - - return conn, nil -} - -// GetGatewayServiceClient returns a new cs3 gateway client -func GetGatewayServiceClient(endpoint string) (gateway.GatewayAPIClient, error) { - // TODO: check connection pooling - conn, err := newConn(endpoint) - if err != nil { - return nil, err - } - - return gateway.NewGatewayAPIClient(conn), nil -}