lfs,tq: rename tq.TransferProgressCallback to tq.ProgressCallback

This commit is contained in:
Taylor Blau 2016-12-11 17:52:00 -07:00
parent 1570e4463d
commit 240ca02f6a
8 changed files with 14 additions and 14 deletions

@ -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)

@ -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)

@ -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.

@ -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.")

@ -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)
}

@ -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)

@ -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
}

@ -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.")