From 9cd148b0fcc711edcac8c6becf8ea3cd31c871eb Mon Sep 17 00:00:00 2001 From: RanXom Date: Mon, 13 Jul 2026 02:01:58 +0530 Subject: doc(scanner): document public API --- internal/scanner/scanner.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'internal/scanner/scanner.go') diff --git a/internal/scanner/scanner.go b/internal/scanner/scanner.go index d304605..2c766fe 100644 --- a/internal/scanner/scanner.go +++ b/internal/scanner/scanner.go @@ -5,10 +5,15 @@ import ( "path/filepath" ) +// Scanner discovers image files from one or more filesystem roots +// +// Scanner is safe for concurrent use after construction, +// provided Scan is not called concurrently type Scanner struct { config Config } +// New creates a Scanner using the supplied configuration. func New(config Config) *Scanner { clean := make([]string, len(config.Roots)) for i, root := range config.Roots { @@ -21,9 +26,14 @@ func New(config Config) *Scanner { } } -// Scan walks every configured root and returns the discovered files. +// Scan recursively walks every configured root and returns the +// discovered image files. +// +// Scan respects context cancellation. +// +// Returned files are deduplicated by absolute path. // -// The returned slice is not guaranteed to be sorted. +// Results are not sorted. func (s *Scanner) Scan(ctx context.Context) ([]File, error) { files := make([]File, 0) seen := make(map[string]struct{}) -- cgit v1.2.3