lfs,tq: rename tq.TransferQueueOption to tq.Option
This commit is contained in:
parent
891db97a42
commit
1570e4463d
@ -40,11 +40,11 @@ func NewDownloadable(p *WrappedPointer) *Downloadable {
|
||||
}
|
||||
|
||||
// NewDownloadCheckQueue builds a checking queue, checks that objects are there but doesn't download
|
||||
func NewDownloadCheckQueue(options ...tq.TransferQueueOption) *tq.TransferQueue {
|
||||
func NewDownloadCheckQueue(options ...tq.Option) *tq.TransferQueue {
|
||||
return tq.NewTransferQueue(tq.Download, options...)
|
||||
}
|
||||
|
||||
// NewDownloadQueue builds a DownloadQueue, allowing concurrent downloads.
|
||||
func NewDownloadQueue(options ...tq.TransferQueueOption) *tq.TransferQueue {
|
||||
func NewDownloadQueue(options ...tq.Option) *tq.TransferQueue {
|
||||
return tq.NewTransferQueue(tq.Download, options...)
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ func NewUploadable(oid, filename string) (*Uploadable, error) {
|
||||
}
|
||||
|
||||
// NewUploadQueue builds an UploadQueue, allowing `workers` concurrent uploads.
|
||||
func NewUploadQueue(options ...tq.TransferQueueOption) *tq.TransferQueue {
|
||||
func NewUploadQueue(options ...tq.Option) *tq.TransferQueue {
|
||||
return tq.NewTransferQueue(tq.Upload, options...)
|
||||
}
|
||||
|
||||
|
@ -136,30 +136,30 @@ type TransferQueue struct {
|
||||
rc *retryCounter
|
||||
}
|
||||
|
||||
type TransferQueueOption func(*TransferQueue)
|
||||
type Option func(*TransferQueue)
|
||||
|
||||
func DryRun(dryRun bool) TransferQueueOption {
|
||||
func DryRun(dryRun bool) Option {
|
||||
return func(tq *TransferQueue) {
|
||||
tq.dryRun = dryRun
|
||||
}
|
||||
}
|
||||
|
||||
func WithProgress(m progress.Meter) TransferQueueOption {
|
||||
func WithProgress(m progress.Meter) Option {
|
||||
return func(tq *TransferQueue) {
|
||||
tq.meter = m
|
||||
}
|
||||
}
|
||||
|
||||
func WithBatchSize(size int) TransferQueueOption {
|
||||
func WithBatchSize(size int) Option {
|
||||
return func(tq *TransferQueue) { tq.batchSize = size }
|
||||
}
|
||||
|
||||
func WithBufferDepth(depth int) TransferQueueOption {
|
||||
func WithBufferDepth(depth int) Option {
|
||||
return func(tq *TransferQueue) { tq.bufferDepth = depth }
|
||||
}
|
||||
|
||||
// NewTransferQueue builds a TransferQueue, direction and underlying mechanism determined by adapter
|
||||
func NewTransferQueue(dir Direction, options ...TransferQueueOption) *TransferQueue {
|
||||
func NewTransferQueue(dir Direction, options ...Option) *TransferQueue {
|
||||
q := &TransferQueue{
|
||||
batchSize: defaultBatchSize,
|
||||
bufferDepth: defaultBatchSize,
|
||||
|
Loading…
Reference in New Issue
Block a user