You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This gives us the flexibility to add more to BeginArgs in the future. It also gives adapters the flexibility to set their own values without worrying about affecting other adapters. Finally, we could add ConcurrentTransfers to *tq.Manifest and get rid of config.Config.ConcurrentTransfers().
Okay, I think I have a good compromise. #1767 now adds a (*tq.Manifest) ConcurrentTransfers() func. So, we can just update the interface to:
typeBeginOptionsinterface {
ConcurrentTransfers() int
}
// ...err:=q.adapter.Begin(q.manifest, cb)
This lets us add more properties to *tq.Manifest, while providing a tighter interface that doesn't have any of the *tq.Manifest functions that get adapters (totally unnecessary inside of an adapter). We may not ever need more than ConcurrentTransfers(), but this way it's pretty easy to add more properties.
Activity
technoweenie commentedon Dec 13, 2016
I ran into an issue with
Begin(), the custom adapter can use a different setting if the implementation is not concurrent:git-lfs/tq/custom.go
Lines 109 to 121 in 39badd3
One thought is to make it a single struct, and change the caller to pass in a new struct:
func (q *TransferQueue) ensureAdapterBegun() error { q.adapterInitMutex.Lock() defer q.adapterInitMutex.Unlock() if q.adapterInProgress { return nil } - // Progress callback - receives byte updates - cb := func(name string, total, read int64, current int) error { - q.meter.TransferBytes(q.transferKind(), name, read, total, current) - return nil - } tracerx.Printf("tq: starting transfer adapter %q", q.adapter.Name()) - err := q.adapter.Begin(config.Config.ConcurrentTransfers(), cb) + err := q.adapter.Begin(BeginArgs{ + ConcurrentTransfers: config.Config.ConcurrentTransfers(), + ProgressCallback: func(name string, total, read int64, current int) error { + q.meter.TransferBytes(q.transferKind(), name, read, total, current) + return nil + }, + })This gives us the flexibility to add more to
BeginArgsin the future. It also gives adapters the flexibility to set their own values without worrying about affecting other adapters. Finally, we could addConcurrentTransfersto*tq.Manifestand get rid ofconfig.Config.ConcurrentTransfers().technoweenie commentedon Dec 14, 2016
Okay, I think I have a good compromise. #1767 now adds a
(*tq.Manifest) ConcurrentTransfers()func. So, we can just update the interface to:This lets us add more properties to
*tq.Manifest, while providing a tighter interface that doesn't have any of the*tq.Manifestfunctions that get adapters (totally unnecessary inside of an adapter). We may not ever need more thanConcurrentTransfers(), but this way it's pretty easy to add more properties.ttaylorr commentedon Dec 14, 2016
Awesome compromise. This looks great! ✨
technoweenie commentedon Dec 15, 2016
I'm making a note of some things while reviewing #1772 I noticed that should be un-exported before
tqlands in master:tq.NewTransfer()tq.BatchI think these can go too IMO.
lfs.NewDownloadable()lfs.NewUploadable()ttaylorr commentedon Dec 15, 2016
Removed in #1776 😄
ttaylorr commentedon Dec 15, 2016
Un-exported in #1777.
ttaylorr commentedon Dec 16, 2016
Re-prioritized this to occur after merging
tq-masterintomaster.ttaylorr commentedon Dec 16, 2016
Merged
tq-masterintomaster. Thanks everybody 😄