From e8ed5f99a87c432bef2e8d82d17c0556936f748a Mon Sep 17 00:00:00 2001 From: Antoon Prins Date: Thu, 24 Jun 2021 13:54:12 +0200 Subject: [PATCH 1/3] New methods PullTransfer,RetryTransfer,ListTransfers. --- internal/grpc/services/datatx/datatx.go | 18 +++++++-- internal/grpc/services/gateway/datatx.go | 48 ++++++++++++++++++++---- 2 files changed, 56 insertions(+), 10 deletions(-) diff --git a/internal/grpc/services/datatx/datatx.go b/internal/grpc/services/datatx/datatx.go index 33e9f73d56..3845469b08 100644 --- a/internal/grpc/services/datatx/datatx.go +++ b/internal/grpc/services/datatx/datatx.go @@ -81,9 +81,9 @@ func (s *service) UnprotectedEndpoints() []string { return []string{} } -func (s *service) CreateTransfer(ctx context.Context, req *datatx.CreateTransferRequest) (*datatx.CreateTransferResponse, error) { - return &datatx.CreateTransferResponse{ - Status: status.NewUnimplemented(ctx, errtypes.NotSupported("CreateTransfer not implemented"), "CreateTransfer not implemented"), +func (s *service) PullTransfer(ctx context.Context, req *datatx.PullTransferRequest) (*datatx.PullTransferResponse, error) { + return &datatx.PullTransferResponse{ + Status: status.NewUnimplemented(ctx, errtypes.NotSupported("PullTransfer not implemented"), "PullTransfer not implemented"), }, nil } @@ -98,3 +98,15 @@ func (s *service) CancelTransfer(ctx context.Context, in *datatx.CancelTransferR Status: status.NewUnimplemented(ctx, errtypes.NotSupported("CancelTransfer not implemented"), "CancelTransfer not implemented"), }, nil } + +func (s *service) ListTransfers(ctx context.Context, in *datatx.ListTransfersRequest) (*datatx.ListTransfersResponse, error) { + return &datatx.ListTransfersResponse{ + Status: status.NewUnimplemented(ctx, errtypes.NotSupported("ListTransfers not implemented"), "ListTransfers not implemented"), + }, nil +} + +func (s *service) RetryTransfer(ctx context.Context, in *datatx.RetryTransferRequest) (*datatx.RetryTransferResponse, error) { + return &datatx.RetryTransferResponse{ + Status: status.NewUnimplemented(ctx, errtypes.NotSupported("RetryTransfer not implemented"), "RetryTransfer not implemented"), + }, nil +} diff --git a/internal/grpc/services/gateway/datatx.go b/internal/grpc/services/gateway/datatx.go index c4d857b910..ac2fed8a3e 100644 --- a/internal/grpc/services/gateway/datatx.go +++ b/internal/grpc/services/gateway/datatx.go @@ -27,18 +27,18 @@ import ( "github.com/pkg/errors" ) -func (s *svc) CreateTransfer(ctx context.Context, req *datatx.CreateTransferRequest) (*datatx.CreateTransferResponse, error) { +func (s *svc) PullTransfer(ctx context.Context, req *datatx.PullTransferRequest) (*datatx.PullTransferResponse, error) { c, err := pool.GetDataTxClient(s.c.DataTxEndpoint) if err != nil { - err = errors.Wrap(err, "gateway: error calling GetOCMShareProviderClient") - return &datatx.CreateTransferResponse{ + err = errors.Wrap(err, "gateway: error calling GetDataTxClient") + return &datatx.PullTransferResponse{ Status: status.NewInternal(ctx, err, "error getting data transfer client"), }, nil } - res, err := c.CreateTransfer(ctx, req) + res, err := c.PullTransfer(ctx, req) if err != nil { - return nil, errors.Wrap(err, "gateway: error calling CreateTransfer") + return nil, errors.Wrap(err, "gateway: error calling PullTransfer") } return res, nil @@ -47,7 +47,7 @@ func (s *svc) CreateTransfer(ctx context.Context, req *datatx.CreateTransferRequ func (s *svc) GetTransferStatus(ctx context.Context, req *datatx.GetTransferStatusRequest) (*datatx.GetTransferStatusResponse, error) { c, err := pool.GetDataTxClient(s.c.DataTxEndpoint) if err != nil { - err = errors.Wrap(err, "gateway: error calling GetOCMShareProviderClient") + err = errors.Wrap(err, "gateway: error calling GetDataTxClient") return &datatx.GetTransferStatusResponse{ Status: status.NewInternal(ctx, err, "error getting data transfer client"), }, nil @@ -64,7 +64,7 @@ func (s *svc) GetTransferStatus(ctx context.Context, req *datatx.GetTransferStat func (s *svc) CancelTransfer(ctx context.Context, req *datatx.CancelTransferRequest) (*datatx.CancelTransferResponse, error) { c, err := pool.GetDataTxClient(s.c.DataTxEndpoint) if err != nil { - err = errors.Wrap(err, "gateway: error calling GetOCMShareProviderClient") + err = errors.Wrap(err, "gateway: error calling GetDataTxClient") return &datatx.CancelTransferResponse{ Status: status.NewInternal(ctx, err, "error getting data transfer client"), }, nil @@ -77,3 +77,37 @@ func (s *svc) CancelTransfer(ctx context.Context, req *datatx.CancelTransferRequ return res, nil } + +func (s *svc) ListTransfers(ctx context.Context, req *datatx.ListTransfersRequest) (*datatx.ListTransfersResponse, error) { + c, err := pool.GetDataTxClient(s.c.DataTxEndpoint) + if err != nil { + err = errors.Wrap(err, "gateway: error calling GetDataTxClient") + return &datatx.ListTransfersResponse{ + Status: status.NewInternal(ctx, err, "error getting data transfer client"), + }, nil + } + + res, err := c.ListTransfers(ctx, req) + if err != nil { + return nil, errors.Wrap(err, "gateway: error calling ListTransfers") + } + + return res, nil +} + +func (s *svc) RetryTransfer(ctx context.Context, req *datatx.RetryTransferRequest) (*datatx.RetryTransferResponse, error) { + c, err := pool.GetDataTxClient(s.c.DataTxEndpoint) + if err != nil { + err = errors.Wrap(err, "gateway: error calling GetDataTxClient") + return &datatx.RetryTransferResponse{ + Status: status.NewInternal(ctx, err, "error getting data transfer client"), + }, nil + } + + res, err := c.RetryTransfer(ctx, req) + if err != nil { + return nil, errors.Wrap(err, "gateway: error calling RetryTransfer") + } + + return res, nil +} From bb4990adbb4a775d9f5974e90885e29490183401 Mon Sep 17 00:00:00 2001 From: Antoon Prins Date: Thu, 24 Jun 2021 14:13:51 +0200 Subject: [PATCH 2/3] Add changelog --- changelog/unreleased/pull-transfer.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelog/unreleased/pull-transfer.md diff --git a/changelog/unreleased/pull-transfer.md b/changelog/unreleased/pull-transfer.md new file mode 100644 index 0000000000..de908f781b --- /dev/null +++ b/changelog/unreleased/pull-transfer.md @@ -0,0 +1,4 @@ +Enhancement: New CS3API datatx methods + +CS3 datatx pull model methods: PullTransfer, RetryTransfer, ListTransfers +Method CreateTransfer removed. From ad716a8b844b01ef3c39c2ea279427e537188135 Mon Sep 17 00:00:00 2001 From: Antoon Prins Date: Thu, 24 Jun 2021 14:27:02 +0200 Subject: [PATCH 3/3] PR link added --- changelog/unreleased/pull-transfer.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/changelog/unreleased/pull-transfer.md b/changelog/unreleased/pull-transfer.md index de908f781b..b02fd62ac2 100644 --- a/changelog/unreleased/pull-transfer.md +++ b/changelog/unreleased/pull-transfer.md @@ -2,3 +2,5 @@ Enhancement: New CS3API datatx methods CS3 datatx pull model methods: PullTransfer, RetryTransfer, ListTransfers Method CreateTransfer removed. + +https://github.com/cs3org/reva/pull/1824 \ No newline at end of file