// 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) }
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) }