## Concurrency ```mermaid sequenceDiagram %% Setup the workers participant Main Note over Main: e.startWorkers()
kicks off some number
of threads per worker type create participant ScannerWorkers Main->>ScannerWorkers: e.startScannerWorkers() Note over ScannerWorkers: ScannerWorkers are primarily
responsible for enumerating
and chunking a source create participant VerificationOverlapWorkers Main->>VerificationOverlapWorkers: e.startVerificationOverlapWorkers() Note over VerificationOverlapWorkers: VerificationOverlapWorkers
handles chunks
matched to multiple
detectors create participant DetectorWorkers Main->>DetectorWorkers: e.startDetectorWorkers() Note over DetectorWorkers: DetectorWorkers are primarily
responsible for running
detectors on chunks create participant NotifierWorkers Main->>NotifierWorkers: e.startNotifierWorkers() Note over NotifierWorkers: Primarily responsible for reporting
results (typically to the cmd line) %% Set up the parallelism par Note over Main,ScannerWorkers: Depending on the type of
scan requested, calls one of
engine.(ScanGit|ScanGitHub|ScanFileSystem|etc) Main->>ScannerWorkers: e.ChunksChan()
<- chunk and Note over ScannerWorkers: Decode chunks and find matching detectors ScannerWorkers->>DetectorWorkers: e.detectableChunksChan
<- detectableChunk Note over ScannerWorkers: When multiple detectors match on the
same chunk we have to decided _which_
detector will verify found secrets ScannerWorkers->>VerificationOverlapWorkers: e.verificationOverlapChunksChan
<- verificationOverlapChunk and Note over VerificationOverlapWorkers: Decide which detectors to run on that chunk VerificationOverlapWorkers->>DetectorWorkers: e.detectableChunksChan
<- detectableChunk and Note over DetectorWorkers: Run detection (finding secrets),
optionally verify them
do filtering and enrichment DetectorWorkers->>NotifierWorkers: e.ResultsChan()|e.results
<-detectors.ResultWithMetadata and Note over NotifierWorkers: Write results to output end ```