Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS3 pulltransfer #1824

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/pull-transfer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: New CS3API datatx methods

CS3 datatx pull model methods: PullTransfer, RetryTransfer, ListTransfers
Method CreateTransfer removed.

https://github.com/cs3org/reva/pull/1824
18 changes: 15 additions & 3 deletions internal/grpc/services/datatx/datatx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}
48 changes: 41 additions & 7 deletions internal/grpc/services/gateway/datatx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
}