microsoft / microsoft/component-detection

Remove Observables and switch to Channels

Open
#772 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type:refactor
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.