Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

monitor and fetch folder in real time and uplod it too #80

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

viveksahu26
Copy link
Contributor

@viveksahu26 viveksahu26 commented Mar 11, 2025

closes #59

This PR add the following changes:

  • It implements folder monitoring feature for the Folder input adapter, enabling real-time detection and uploading of SBOMs as they become available, using a daemon mode triggered by the -d flag.
  • New Interface MonitorAdapter is added to differntiate adapter with monitoring capability an non-monitorig. All input adapters will be implementing it for now.
    • The Monitor method of MonitorAdapter is invoked when -d flag is provided. If not provided then FetchSBOMs is invoked.
    • FetchSBOMs represent to single time fetching of all SBOMs.
    • Whereas, Monitor method in MonitorAdapter interface, fetches SBOMs in real time, when any event is made.
  • Folder Adapter implemented Monitor method to support real-time monitoring.
  • Added WatcherIterator to store SBOM in real time. It recieves a SBOM when a newly SBOM is added to a folder or existing SBOM is modified. In bboth cases, the iterator recieves the SBOMs on a real time via channel. Whereas earlier FolderIterator used to store all SBOMs in one go, and that was fetched in a sequential or parallel manner.
  • Simialrly, these iterator are used while uploading SBOMs. The FolderIterator used to upload all SBOM until and unless list becomes exhausted i.e EOF, but WatcherIterator doesn't close until and unless the channel is closed. And the channel closes on context cancellation or watcher error or ctrl+c.
  • Add methods to alteast implement for github adapter. For now, will return an error that github doesn't support real-time monitoring.

Although I have tested for folder --> interlynk. it works perfectlly fine. The watcher is trigger in2 cases:

  • when newly sbom is added
  • when existing sbom is modifies.
    In both case, they are feeded to channel, and then it is uploaded.

@viveksahu26 viveksahu26 force-pushed the feature/folder_monitor_watcher branch from c238c24 to 32cc408 Compare March 12, 2025 10:18
Signed-off-by: Vivek Kumar Sahu <[email protected]>
@viveksahu26 viveksahu26 force-pushed the feature/folder_monitor_watcher branch from 32e1c66 to 39defcb Compare March 12, 2025 17:00
@viveksahu26 viveksahu26 marked this pull request as ready for review March 12, 2025 19:25
Signed-off-by: Vivek Kumar Sahu <[email protected]>
@viveksahu26 viveksahu26 force-pushed the feature/folder_monitor_watcher branch from e07550b to a2556ce Compare March 13, 2025 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Folder Watcher - Monitor directory or directories and upload sboms
1 participant