Skip to content

Tracking: tq package #1764

Closed
Closed

Description

@ttaylorr

This issue serves as a place to track the remaining 👊-items for merging tq-master into master.

Original proposal: #1651.

To-do


/cc @git-lfs/core

Activity

  1. added this to the v2.0.0 milestone on Dec 13, 2016
  2. self-assigned this
    on Dec 13, 2016
  3. technoweenie commented on Dec 13, 2016

    @technoweenie
    Contributor

    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

    func (a *customAdapter) Begin(maxConcurrency int, cb ProgressCallback) error {
    // If config says not to launch multiple processes, downgrade incoming value
    useConcurrency := maxConcurrency
    if !a.concurrent {
    useConcurrency = 1
    }
    a.originalConcurrency = maxConcurrency
    tracerx.Printf("xfer: Custom transfer adapter %q using concurrency %d", a.name, useConcurrency)
    // Use common workers impl, but downgrade workers to number of processes
    return a.adapterBase.Begin(useConcurrency, cb)
    }

    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 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().

  4. technoweenie commented on Dec 14, 2016

    @technoweenie
    Contributor

    Okay, I think I have a good compromise. #1767 now adds a (*tq.Manifest) ConcurrentTransfers() func. So, we can just update the interface to:

    type BeginOptions interface {
      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.

  5. ttaylorr commented on Dec 14, 2016

    @ttaylorr
    ContributorAuthor

    Awesome compromise. This looks great! ✨

  6. technoweenie commented on Dec 15, 2016

    @technoweenie
    Contributor

    I'm making a note of some things while reviewing #1772 I noticed that should be un-exported before tq lands in master:

    • tq.NewTransfer()
    • tq.Batch

    I think these can go too IMO.

    • lfs.NewDownloadable()
    • lfs.NewUploadable()
  7. ttaylorr commented on Dec 15, 2016

    @ttaylorr
    ContributorAuthor

    I think these can go too IMO.

    • lfs.NewDownloadable()
    • lfs.NewUploadable()

    Removed in #1776 😄

  8. ttaylorr commented on Dec 15, 2016

    @ttaylorr
    ContributorAuthor

    I noticed that should be un-exported before tq lands in master:

    • tq.NewTransfer()
    • tq.Batch

    Un-exported in #1777.

  9. ttaylorr commented on Dec 16, 2016

    @ttaylorr
    ContributorAuthor
    • Split adapter implementations into sub-package: tq/transferadapter (name pending).

    Re-prioritized this to occur after merging tq-master into master.

  10. ttaylorr commented on Dec 16, 2016

    @ttaylorr
    ContributorAuthor

    Merged tq-master into master. Thanks everybody 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions