diff --git a/lfs/pointer_smudge.go b/lfs/pointer_smudge.go index 3c5ea905..51c21769 100644 --- a/lfs/pointer_smudge.go +++ b/lfs/pointer_smudge.go @@ -86,7 +86,7 @@ func downloadFile(writer io.Writer, ptr *Pointer, workingfile, mediafile string, } adapter := manifest.NewDownloadAdapter(adapterName) - var tcb tq.TransferProgressCallback + var tcb tq.ProgressCallback if cb != nil { tcb = func(name string, totalSize, readSoFar int64, readSinceLast int) error { return cb(totalSize, readSoFar, readSinceLast) diff --git a/tq/adapterbase.go b/tq/adapterbase.go index 95574591..8dd8bf8c 100644 --- a/tq/adapterbase.go +++ b/tq/adapterbase.go @@ -24,7 +24,7 @@ type adapterBase struct { direction Direction transferImpl transferImplementation jobChan chan *job - cb TransferProgressCallback + cb ProgressCallback outChan chan TransferResult // WaitGroup to sync the completion of all workers workerWait sync.WaitGroup @@ -49,7 +49,7 @@ type transferImplementation interface { // Implementations can clean up per-worker resources here, context is as returned from WorkerStarting WorkerEnding(workerNum int, ctx interface{}) // DoTransfer performs a single transfer within a worker. ctx is any context returned from WorkerStarting - DoTransfer(ctx interface{}, t *Transfer, cb TransferProgressCallback, authOkFunc func()) error + DoTransfer(ctx interface{}, t *Transfer, cb ProgressCallback, authOkFunc func()) error } func newAdapterBase(name string, dir Direction, ti transferImplementation) *adapterBase { @@ -70,7 +70,7 @@ func (a *adapterBase) Direction() Direction { return a.direction } -func (a *adapterBase) Begin(maxConcurrency int, cb TransferProgressCallback, completion chan TransferResult) error { +func (a *adapterBase) Begin(maxConcurrency int, cb ProgressCallback, completion chan TransferResult) error { a.cb = cb a.outChan = completion a.jobChan = make(chan *job, 100) @@ -211,7 +211,7 @@ func (a *adapterBase) worker(workerNum int, ctx interface{}) { a.workerWait.Done() } -func advanceCallbackProgress(cb TransferProgressCallback, t *Transfer, numBytes int64) { +func advanceCallbackProgress(cb ProgressCallback, t *Transfer, numBytes int64) { if cb != nil { // Must split into max int sizes since read count is int const maxInt = int(^uint(0) >> 1) diff --git a/tq/basic_download.go b/tq/basic_download.go index 0dc809e8..dd5b0b64 100644 --- a/tq/basic_download.go +++ b/tq/basic_download.go @@ -43,7 +43,7 @@ func (a *basicDownloadAdapter) WorkerStarting(workerNum int) (interface{}, error func (a *basicDownloadAdapter) WorkerEnding(workerNum int, ctx interface{}) { } -func (a *basicDownloadAdapter) DoTransfer(ctx interface{}, t *Transfer, cb TransferProgressCallback, authOkFunc func()) error { +func (a *basicDownloadAdapter) DoTransfer(ctx interface{}, t *Transfer, cb ProgressCallback, authOkFunc func()) error { f, fromByte, hashSoFar, err := a.checkResumeDownload(t) if err != nil { @@ -84,7 +84,7 @@ func (a *basicDownloadAdapter) downloadFilename(t *Transfer) string { } // download starts or resumes and download. Always closes dlFile if non-nil -func (a *basicDownloadAdapter) download(t *Transfer, cb TransferProgressCallback, authOkFunc func(), dlFile *os.File, fromByte int64, hash hash.Hash) error { +func (a *basicDownloadAdapter) download(t *Transfer, cb ProgressCallback, authOkFunc func(), dlFile *os.File, fromByte int64, hash hash.Hash) error { if dlFile != nil { // ensure we always close dlFile. Note that this does not conflict with the // early close below, as close is idempotent. diff --git a/tq/basic_upload.go b/tq/basic_upload.go index 440a462e..d1647841 100644 --- a/tq/basic_upload.go +++ b/tq/basic_upload.go @@ -44,7 +44,7 @@ func (a *basicUploadAdapter) WorkerStarting(workerNum int) (interface{}, error) func (a *basicUploadAdapter) WorkerEnding(workerNum int, ctx interface{}) { } -func (a *basicUploadAdapter) DoTransfer(ctx interface{}, t *Transfer, cb TransferProgressCallback, authOkFunc func()) error { +func (a *basicUploadAdapter) DoTransfer(ctx interface{}, t *Transfer, cb ProgressCallback, authOkFunc func()) error { rel, ok := t.Object.Rel("upload") if !ok { return fmt.Errorf("No upload action for this object.") diff --git a/tq/custom.go b/tq/custom.go index 9fd4ab8a..8c2c5470 100644 --- a/tq/custom.go +++ b/tq/custom.go @@ -106,7 +106,7 @@ type customAdapterResponseMessage struct { BytesSinceLast int `json:"bytesSinceLast"` } -func (a *customAdapter) Begin(maxConcurrency int, cb TransferProgressCallback, completion chan TransferResult) error { +func (a *customAdapter) Begin(maxConcurrency int, cb ProgressCallback, completion chan TransferResult) error { // If config says not to launch multiple processes, downgrade incoming value useConcurrency := maxConcurrency if !a.concurrent { @@ -257,7 +257,7 @@ func (a *customAdapter) WorkerEnding(workerNum int, ctx interface{}) { } } -func (a *customAdapter) DoTransfer(ctx interface{}, t *Transfer, cb TransferProgressCallback, authOkFunc func()) error { +func (a *customAdapter) DoTransfer(ctx interface{}, t *Transfer, cb ProgressCallback, authOkFunc func()) error { if ctx == nil { return fmt.Errorf("Custom transfer %q was not properly initialized, see previous errors", a.name) } diff --git a/tq/transfer.go b/tq/transfer.go index d2bb122b..b281a251 100644 --- a/tq/transfer.go +++ b/tq/transfer.go @@ -17,7 +17,7 @@ const ( // name and dir are to provide context if one func implements many instances type NewTransferAdapterFunc func(name string, dir Direction) TransferAdapter -type TransferProgressCallback func(name string, totalSize, readSoFar int64, readSinceLast int) error +type ProgressCallback func(name string, totalSize, readSoFar int64, readSinceLast int) error // TransferAdapter is implemented by types which can upload and/or download LFS // file content to a remote store. Each TransferAdapter accepts one or more requests @@ -44,7 +44,7 @@ type TransferAdapter interface { // that may be done at once. The passed in callback will receive updates on // progress, and the completion channel will receive completion notifications // Either argument may be nil if not required by the client - Begin(maxConcurrency int, cb TransferProgressCallback, completion chan TransferResult) error + Begin(maxConcurrency int, cb ProgressCallback, completion chan TransferResult) error // Add queues a download/upload, which will complete asynchronously and // notify the callbacks given to Begin() Add(transfers ...*Transfer) (results <-chan TransferResult) diff --git a/tq/transfer_test.go b/tq/transfer_test.go index f26c55c2..5382c8b6 100644 --- a/tq/transfer_test.go +++ b/tq/transfer_test.go @@ -21,7 +21,7 @@ func (a *testAdapter) Direction() Direction { return a.dir } -func (a *testAdapter) Begin(maxConcurrency int, cb TransferProgressCallback, completion chan TransferResult) error { +func (a *testAdapter) Begin(maxConcurrency int, cb ProgressCallback, completion chan TransferResult) error { return nil } diff --git a/tq/tus_upload.go b/tq/tus_upload.go index 027a85b4..0f8d1ef5 100644 --- a/tq/tus_upload.go +++ b/tq/tus_upload.go @@ -36,7 +36,7 @@ func (a *tusUploadAdapter) WorkerStarting(workerNum int) (interface{}, error) { func (a *tusUploadAdapter) WorkerEnding(workerNum int, ctx interface{}) { } -func (a *tusUploadAdapter) DoTransfer(ctx interface{}, t *Transfer, cb TransferProgressCallback, authOkFunc func()) error { +func (a *tusUploadAdapter) DoTransfer(ctx interface{}, t *Transfer, cb ProgressCallback, authOkFunc func()) error { rel, ok := t.Object.Rel("upload") if !ok { return fmt.Errorf("No upload action for this object.")