-
Notifications
You must be signed in to change notification settings - Fork 40
Analysis Progress Monitoring Improvement #419
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7dff746
added the observer interface for monitoring analysis progress. conver…
SUSTAPLE117 e78a61f
addressed comments
SUSTAPLE117 2c12991
as it should have been removed progress bar entirely from analysis. N…
SUSTAPLE117 1dc9b79
lint
SUSTAPLE117 fc05c01
better step vs repos for bar pogression management
SUSTAPLE117 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| package analyze | ||
|
|
||
| import "github.com/boostsecurityio/poutine/models" | ||
|
|
||
| // ProgressObserver receives structured progress events during analysis. | ||
| // All methods must be non-blocking — implementations should not perform | ||
| // expensive I/O or hold locks for extended periods. | ||
| // | ||
| // # Concurrency | ||
| // | ||
| // During AnalyzeOrg, methods are called from two contexts: | ||
| // | ||
| // Main goroutine (sequential, never concurrent with each other): | ||
| // - OnDiscoveryCompleted | ||
| // - OnRepoSkipped | ||
| // - OnFinalizeStarted | ||
| // - OnFinalizeCompleted | ||
| // | ||
| // Worker goroutines (called concurrently from multiple goroutines): | ||
| // - OnRepoStarted | ||
| // - OnRepoCompleted | ||
| // - OnRepoError | ||
| // | ||
| // Implementations MUST ensure that the worker-goroutine methods are | ||
| // goroutine-safe. Note that worker methods may also run concurrently | ||
| // with the main-goroutine methods above. | ||
| // | ||
| // During AnalyzeRepo and AnalyzeStaleBranches all methods are called | ||
| // from a single goroutine. | ||
| type ProgressObserver interface { | ||
| // OnDiscoveryCompleted is called from the main goroutine when the | ||
| // total repo count is known (first batch with TotalCount > 0). | ||
| OnDiscoveryCompleted(org string, totalCount int) | ||
|
|
||
| // OnRepoStarted is called from a worker goroutine when analysis | ||
| // of a repo begins. Must be goroutine-safe. | ||
| OnRepoStarted(repo string) | ||
|
|
||
| // OnRepoCompleted is called from a worker goroutine when a repo | ||
| // finishes successfully. Must be goroutine-safe. | ||
| OnRepoCompleted(repo string, pkg *models.PackageInsights) | ||
|
|
||
| // OnRepoError is called from a worker goroutine when a repo | ||
| // analysis fails (non-fatal). Must be goroutine-safe. | ||
| OnRepoError(repo string, err error) | ||
|
|
||
| // OnRepoSkipped is called from the main goroutine when a repo is | ||
| // skipped (fork, empty, etc.). | ||
| OnRepoSkipped(repo string, reason string) | ||
|
|
||
| // OnFinalizeStarted is called from the main goroutine when the | ||
| // formatting/output phase begins, after all repos are processed. | ||
| OnFinalizeStarted(totalPackages int) | ||
|
|
||
| // OnFinalizeCompleted is called from the main goroutine when | ||
| // formatting is done. | ||
| OnFinalizeCompleted() | ||
| } | ||
|
|
||
| type noopObserver struct{} | ||
|
|
||
| func (noopObserver) OnDiscoveryCompleted(string, int) {} | ||
| func (noopObserver) OnRepoStarted(string) {} | ||
| func (noopObserver) OnRepoCompleted(string, *models.PackageInsights) {} | ||
| func (noopObserver) OnRepoError(string, error) {} | ||
| func (noopObserver) OnRepoSkipped(string, string) {} | ||
| func (noopObserver) OnFinalizeStarted(int) {} | ||
| func (noopObserver) OnFinalizeCompleted() {} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.