func (v *Verifier) InParallel(ctx context.Context, enqueue func(tw *TreeWalker) error) error {
	tw := NewTreeWalker(TreeWalkerOptions{
		Parallelism:   v.opts.Parallelism,
		EntryCallback: v.verifyObject,
		MaxErrors:     v.opts.MaxErrors,
	})
	defer tw.Close()

	v.fileWorkQueue = make(chan verifyFileWorkItem, v.opts.FileQueueLength)

	for i := 0; i < v.opts.Parallelism; i++ {
		v.workersWG.Add(1)

		go func() {
			defer v.workersWG.Done()

			for wi := range v.fileWorkQueue {
				if tw.TooManyErrors() {
					continue
				}

				if err := v.VerifyFile(ctx, wi.oid, wi.entryPath); err != nil {
					tw.ReportError(ctx, wi.entryPath, err)
				}
			}
		}()
	}

	err := enqueue(tw)

	close(v.fileWorkQueue)
	v.workersWG.Wait()
	v.fileWorkQueue = nil

	if err != nil {
		return err
	}

	return tw.Err()
}
// InParallel starts parallel verification and invokes the provided function which can call
// call Process() on in the provided TreeWalker.
InParallel starts parallel verification and invokes the provided function which can call
call Process() on in the provided TreeWalker.
// InParallel starts parallel verification and invokes the provided function which can call // call Process () on in the provided TreeWalker .
func (v *Verifier) InParallel(ctx context.Context, enqueue func(tw *TreeWalker) error) error {
	tw := NewTreeWalker(TreeWalkerOptions{
		Parallelism:   v.opts.Parallelism,
		EntryCallback: v.verifyObject,
		MaxErrors:     v.opts.MaxErrors,
	})
	defer tw.Close()
	v.fileWorkQueue = make(chan verifyFileWorkItem, v.opts.FileQueueLength)
	for i := 0; i < v.opts.Parallelism; i++ {
		v.workersWG.Add(1)
		go func() {
			defer v.workersWG.Done()
			for wi := range v.fileWorkQueue {
				if tw.TooManyErrors() {
					continue
				}
				if err := v.VerifyFile(ctx, wi.oid, wi.entryPath); err != nil {
					tw.ReportError(ctx, wi.entryPath, err)
				}
			}
		}()
	}
	err := enqueue(tw)
	close(v.fileWorkQueue)
	v.workersWG.Wait()
	v.fileWorkQueue = nil
	if err != nil {
		return err
	}
	return tw.Err()
}
func ( v * Verifier ) InParallel ( ctx context . Context , enqueue func ( tw * TreeWalker ) error ) error { tw := NewTreeWalker ( TreeWalkerOptions { Parallelism : v . opts . Parallelism , EntryCallback : v . verifyObject , MaxErrors : v . opts . MaxErrors , } ) defer tw . Close ( ) v . fileWorkQueue = make ( chan verifyFileWorkItem , v . opts . FileQueueLength ) for i := 0 ; i < v . opts . Parallelism ; i ++ { v . workersWG . Add ( 1 ) go func ( ) { defer v . workersWG . Done ( ) for wi := range v . fileWorkQueue { if tw . TooManyErrors ( ) { continue } if err := v . VerifyFile ( ctx , wi . oid , wi . entryPath ) ; err != nil { tw . ReportError ( ctx , wi . entryPath , err ) } } } ( ) } err := enqueue ( tw ) close ( v . fileWorkQueue ) v . workersWG . Wait ( ) v . fileWorkQueue = nil if err != nil { return err } return tw . Err ( ) }
InParallel starts parallel verification and invokes the provided function which can call
call Process() on in the provided TreeWalker.
InParallel starts parallel verification and invokes the provided function which can call call Process () on in the provided TreeWalker .