MCPcopy
hub / github.com/git-lfs/git-lfs / Add

Method Add

tq/transfer_queue.go:357–390  ·  view source on GitHub ↗

Add adds a *Transfer to the transfer queue. It only increments the amount of waiting the TransferQueue has to do if the *Transfer "t" is new. If another transfer(s) with the same OID has been added to the *TransferQueue already, the given transfer will not be enqueued, but will be sent to any chann

(name, path, oid string, size int64, missing bool, err error)

Source from the content-addressed store, hash-verified

355// Only one file will be transferred to/from the Path element of the first
356// transfer.
357func (q *TransferQueue) Add(name, path, oid string, size int64, missing bool, err error) {
358 q.Upgrade()
359
360 if err != nil {
361 q.errorc <- err
362 return
363 }
364
365 t := &objectTuple{
366 Name: name,
367 Path: path,
368 Oid: oid,
369 Size: size,
370 Missing: missing,
371 }
372
373 if objs := q.remember(t); len(objs.objects) > 1 {
374 if objs.completed {
375 // If there is already a completed transfer chain for
376 // this OID, then this object is already "done", and can
377 // be sent through as completed to the watchers.
378 for _, w := range q.watchers {
379 w <- t.ToTransfer()
380 }
381 }
382
383 // If the chain is not done, there is no reason to enqueue this
384 // transfer into 'q.incoming'.
385 tracerx.Printf("already transferring %q, skipping duplicate", t.Oid)
386 return
387 }
388
389 q.incoming <- t
390}
391
392// remember remembers the *Transfer "t" if the *TransferQueue doesn't already
393// know about a Transfer with the same OID.

Callers 4

downloadFileMethod · 0.95
downloadFileFallBackMethod · 0.95
pruneFunction · 0.95
buildTestDataFunction · 0.95

Calls 3

UpgradeMethod · 0.95
rememberMethod · 0.95
ToTransferMethod · 0.95

Tested by

no test coverage detected