Skip to content

Commit

Permalink
Now using cs3 datatx statuses.
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoon Prins committed Nov 12, 2020
1 parent 8cc32ea commit 81ef606
Showing 1 changed file with 7 additions and 52 deletions.
59 changes: 7 additions & 52 deletions pkg/datatx/driver/txdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,63 +19,18 @@
package driver

import (
datatx "github.com/cs3org/go-cs3apis/cs3/tx/v1beta1"
config "github.com/cs3org/reva/pkg/datatx/driver/config"
)

// StatusInvalid Invalid transfer status
const StatusInvalid string = "STATUS_INVALID"

// StatusDestinationNotFound The destination could not be found.
const StatusDestinationNotFound string = "STATUS_DESTINATION_NOT_FOUND"

// StatusTransferNew A new data transfer
const StatusTransferNew string = "STATUS_TRANSFER_NEW"

// // The data transfer is awaiting acceptance from the destination
// const STATUS_TRANSFER_AWAITING_ACCEPTANCE string = "STATUS_TRANSFER_AWAITING_ACCEPTANCE"

// // The data transfer is accepted by the destination.
// const STATUS_TRANSFER_ACCEPTED string = "STATUS_TRANSFER_ACCEPTED"

// StatusTransferInProgress The data transfer has started and not yet completed.
const StatusTransferInProgress string = "STATUS_TRANSFER_IN_PROGRESS"

// StatusTransferComplete The data transfer has completed.
const StatusTransferComplete string = "STATUS_TRANSFER_COMPLETE"

// StatusTransferFailed The data transfer has failed.
const StatusTransferFailed string = "STATUS_TRANSFER_FAILED"

// StatusTransferCancelled The data transfer had been cancelled.
const StatusTransferCancelled string = "STATUS_TRANSFER_CANCELLED"

// StatusTransferCancelFailed The request for cancelling the data transfer has failed.
const StatusTransferCancelFailed string = "STATUS_TRANSFER_CANCEL_FAILED"

// // The transfer has expired somewhere down the line.
// const STATUS_TRANSFER_EXPIRED string = "STATUS_TRANSFER_EXPIRED"

// Job the transfer job
type Job struct {
JobID int64
SrcRemote Remote
DestRemote Remote
}

// Remote a remote in the transfer, either source or destination
type Remote struct {
OpaqueID int64
OpaqueName string
}

// TxDriver the interface any transfer driver should implement
type TxDriver interface {
// Configure configures the reader according to the specified configuration
Configure(c *config.Config) error
// DoTransfer initiates a transfer and returns the transfer job ID
DoTransfer(srcRemote string, srcPath string, srcToken string, destRemote string, destPath string, destToken string) (*Job, error)
// GetTransferStatus returns the status of the transfer defined by the specified job
GetTransferStatus(job *Job) (string, error)
// CancelTransfer cancels the transfer defined by the specified job nd returns the status
CancelTransfer(job *Job) (string, error)
// DoTransfer initiates a transfer and returns the transfer job id
DoTransfer(srcRemote string, srcPath string, srcToken string, destRemote string, destPath string, destToken string) (int64, error)
// GetTransferStatus returns the status of the transfer with the specified job id
GetTransferStatus(jobID int64) (datatx.TxInfo_Status, error)
// CancelTransfer cancels the transfer with the specified job id and returns the status
CancelTransfer(jobID int64) (datatx.TxInfo_Status, error)
}

0 comments on commit 81ef606

Please sign in to comment.