component-detection
component-detection copied to clipboard
Remove Observables and switch to Channels
Our current implementation for scanning files/directories is done by using observables:
https://github.com/microsoft/component-detection/blob/29e89522bb3c243be4aa8e188ce2b8c57e96420b/src/Microsoft.ComponentDetection.Common/FastDirectoryWalkerFactory.cs#L32
Instead, we should architect a channel system that works as:
- Create a new Task & Channel for each detector
- Launch each detector with a semphore blocking execution untill all detectors have subscribed to the channel
- Begin scanning directories
- Each file found will get sent through the channel
- Detector gets the message, and scans file or ignores it depending on the pattern
We could also implement a Broadcast channel similar to https://docs.rs/tokio/latest/tokio/sync/index.html#broadcast-channel
AB#2102424