Example #1
0
File: pull.go Project: arv/noms-old
// CopyReachableChunksP copies to |sink| all chunks reachable from (and including) |r|, but that are not in the subtree rooted at |exclude|
func CopyReachableChunksP(source, sink DataStore, sourceRef, exclude ref.Ref, concurrency int) {
	excludeRefs := map[ref.Ref]bool{}

	if !exclude.IsEmpty() {
		mu := sync.Mutex{}
		excludeCallback := func(r ref.Ref) bool {
			mu.Lock()
			excludeRefs[r] = true
			mu.Unlock()
			return false
		}

		walk.SomeChunksP(exclude, source, excludeCallback, concurrency)
	}

	copyCallback := func(r ref.Ref) bool {
		return excludeRefs[r]
	}
	copyWorker(source, sink.transitionalChunkSink(), sourceRef, copyCallback, concurrency)
}
Example #2
0
File: pull.go Project: arv/noms-old
func copyWorker(source DataStore, sink chunks.ChunkSink, sourceRef ref.Ref, stopFn walk.SomeChunksCallback, concurrency int) {
	tcs := &teeDataSource{source.transitionalChunkStore(), sink}
	walk.SomeChunksP(sourceRef, tcs, stopFn, concurrency)
}