Add custom types for type safety throughout codebase
- Add FileCount, FileSize, RelFilePath, AbsFilePath, ModTime, Multihash types - Add UnixSeconds and UnixNanos types for timestamp handling - Add URL types (ManifestURL, FileURL, BaseURL) with safe path joining - Consolidate scanner package into mfer package - Update checker to use custom types in Result and CheckStatus - Add ModTime.Timestamp() method for protobuf conversion - Update all tests to use proper custom types
This commit is contained in:
@@ -13,29 +13,29 @@ import (
|
||||
"github.com/spf13/afero"
|
||||
"github.com/urfave/cli/v2"
|
||||
"sneak.berlin/go/mfer/internal/log"
|
||||
"sneak.berlin/go/mfer/internal/scanner"
|
||||
"sneak.berlin/go/mfer/mfer"
|
||||
)
|
||||
|
||||
func (mfa *CLIApp) generateManifestOperation(ctx *cli.Context) error {
|
||||
log.Debug("generateManifestOperation()")
|
||||
|
||||
opts := &scanner.Options{
|
||||
opts := &mfer.ScannerOptions{
|
||||
IncludeDotfiles: ctx.Bool("IncludeDotfiles"),
|
||||
FollowSymLinks: ctx.Bool("FollowSymLinks"),
|
||||
Fs: mfa.Fs,
|
||||
}
|
||||
|
||||
s := scanner.NewWithOptions(opts)
|
||||
s := mfer.NewScannerWithOptions(opts)
|
||||
|
||||
// Phase 1: Enumeration - collect paths and stat files
|
||||
args := ctx.Args()
|
||||
showProgress := ctx.Bool("progress")
|
||||
|
||||
// Set up enumeration progress reporting
|
||||
var enumProgress chan scanner.EnumerateStatus
|
||||
var enumProgress chan mfer.EnumerateStatus
|
||||
var enumWg sync.WaitGroup
|
||||
if showProgress {
|
||||
enumProgress = make(chan scanner.EnumerateStatus, 1)
|
||||
enumProgress = make(chan mfer.EnumerateStatus, 1)
|
||||
enumWg.Add(1)
|
||||
go func() {
|
||||
defer enumWg.Done()
|
||||
@@ -117,10 +117,10 @@ func (mfa *CLIApp) generateManifestOperation(ctx *cli.Context) error {
|
||||
}()
|
||||
|
||||
// Phase 2: Scan - read file contents and generate manifest
|
||||
var scanProgress chan scanner.ScanStatus
|
||||
var scanProgress chan mfer.ScanStatus
|
||||
var scanWg sync.WaitGroup
|
||||
if showProgress {
|
||||
scanProgress = make(chan scanner.ScanStatus, 1)
|
||||
scanProgress = make(chan mfer.ScanStatus, 1)
|
||||
scanWg.Add(1)
|
||||
go func() {
|
||||
defer scanWg.Done()
|
||||
|
||||
Reference in New Issue
Block a user