// ParallelScanIterator is a thread safe method that performs a parallel scan on dynamodb utilizing the configured amount of workers
ParallelScanIterator is a thread safe method that performs a parallel scan on dynamodb utilizing the configured amount of workers
// ParallelScanIterator is a thread safe method that performs a parallel scan on dynamodb utilizing the configured amount of workers
func (c *Client) ParallelScanIterator(ctx context.Context, input *dynamodb.ScanInput, workers int, fn func(output *dynamodb.ScanOutput) error, noLock bool) error {
	var mu sync.Mutex
	var wg sync.WaitGroup
	errChan := make(chan error, 1)
	workerCtx, cancel := context.WithCancel(ctx)
	defer cancel()
	wg.Add(workers)
	input.TotalSegments = aws.Int64(int64(workers))
	for i := 0; i < workers; i++ {
		go c.parallelScanWorker(workerCtx, i, *input, &wg, errChan, &mu, noLock, fn)
	}
	go func() {
		wg.Wait()
		cancel()
	}()
	select {
	case err := <-errChan:
		return err
	case <-workerCtx.Done():
	}
	return nil
}
func ( c * Client ) ParallelScanIterator ( ctx context . Context , input * dynamodb . ScanInput , workers int , fn func ( output * dynamodb . ScanOutput ) error , noLock bool ) error { var mu sync . Mutex var wg sync . WaitGroup errChan := make ( chan error , 1 ) workerCtx , cancel := context . WithCancel ( ctx ) defer cancel ( ) wg . Add ( workers ) input . TotalSegments = aws . Int64 ( int64 ( workers ) ) for i := 0 ; i < workers ; i ++ { go c . parallelScanWorker ( workerCtx , i , * input , & wg , errChan , & mu , noLock , fn ) } go func ( ) { wg . Wait ( ) cancel ( ) } ( ) select { case err := <- errChan : return err case <- workerCtx . Done ( ) : } return nil }
ParallelScanIterator is a thread safe method that performs a parallel scan on dynamodb utilizing the configured amount of workers
ParallelScanIterator is a thread safe method that performs a parallel scan on dynamodb utilizing the configured amount of workers