microsoft / microsoft/component-detection
Remove Observables and switch to Channels
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 553
- Forks
- 135
- Avg merge
- 20h 58m
- Merged PRs (30d)
- 6
Description
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:
1. Create a new Task & Channel for each detector
2. Launch each detector with a semphore blocking execution untill all detectors have subscribed to the channel
3. Begin scanning directories
4. Each file found will get sent through the channel
5. 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/Microsoft.ComponentDetection.Common/FastDirectoryWalkerFactory.cs, especially the observable-based scanning implementation linked in the issue. Trace how detectors subscribe and consume files, then define the channel lifecycle and synchronization; the work is done when directory results reach each detector through channels without the existing observables.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100