Documentation
¶
Overview ¶
Package scanner turns a source tree into WFP fingerprints. It collects the files to scan (delegating filtering to pkg/filter via CollectFiles / CollectFilesWithOptions) and fingerprints them in parallel through a bounded worker pool (WorkerPool / GenerateWFP) using the WFP algorithm.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectFiles ¶
CollectFiles recursively collects the files to scan under rootPath, applying the built-in default filters (skip lists, sizes) plus any .gitignore in the tree. Kept for backward compatibility; use CollectFilesWithOptions to also apply scanoss.json rules or to override the defaults.
func CollectFilesWithOptions ¶
CollectFilesWithOptions recursively collects the files to scan under rootPath, applying the given filter options (defaults, scanoss.json skip rules, .gitignore, size bounds). It returns the files to scan and a count of skipped files.
func GenerateWFP ¶
func GenerateWFP(files []string, workers int, root string, onProgress func(done, total int)) ([]byte, []error)
GenerateWFP fingerprints the given files with a worker pool and returns the combined WFP byte stream. onProgress, if non-nil, is called as each file completes (done, total). Files that fail to fingerprint are skipped and returned in the error slice (best-effort).
Types ¶
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool manages a pool of workers to process files in parallel
func NewWorkerPool ¶
func NewWorkerPool(numWorkers int) *WorkerPool
NewWorkerPool creates a new worker pool
func (*WorkerPool) Close ¶
func (wp *WorkerPool) Close()
Close closes the channels and waits for workers to finish
func (*WorkerPool) Errors ¶
func (wp *WorkerPool) Errors() <-chan error
Errors returns the errors channel
func (*WorkerPool) Results ¶
func (wp *WorkerPool) Results() <-chan *fingerprint.FileFingerprint
Results returns the results channel
func (*WorkerPool) Submit ¶
func (wp *WorkerPool) Submit(filePath string)
Submit sends a file to be processed