(e lfshttp.Endpoint)
| 922 | } |
| 923 | |
| 924 | func (q *TransferQueue) ensureAdapterBegun(e lfshttp.Endpoint) error { |
| 925 | q.Upgrade() |
| 926 | |
| 927 | q.adapterInitMutex.Lock() |
| 928 | defer q.adapterInitMutex.Unlock() |
| 929 | |
| 930 | if q.adapterInProgress { |
| 931 | return nil |
| 932 | } |
| 933 | |
| 934 | // Progress callback - receives byte updates |
| 935 | cb := func(name string, total, read int64, current int) error { |
| 936 | q.meter.TransferBytes(q.direction.String(), name, read, total, current) |
| 937 | if q.cb != nil { |
| 938 | // NOTE: this is the mechanism by which the logpath |
| 939 | // specified by GIT_LFS_PROGRESS is written to. |
| 940 | // |
| 941 | // See: lfs.downloadFile() for more. |
| 942 | q.cb(total, read, current) |
| 943 | } |
| 944 | return nil |
| 945 | } |
| 946 | |
| 947 | tracerx.Printf("tq: starting transfer adapter %q", q.adapter.Name()) |
| 948 | err := q.adapter.Begin(q.toAdapterCfg(e), cb) |
| 949 | if err != nil { |
| 950 | return err |
| 951 | } |
| 952 | q.adapterInProgress = true |
| 953 | |
| 954 | return nil |
| 955 | } |
| 956 | |
| 957 | func (q *TransferQueue) toAdapterCfg(e lfshttp.Endpoint) AdapterConfig { |
| 958 | apiClient := q.manifest.APIClient() |
no test coverage detected