fix: resolve benchmark and build tag conflicts

- Remove duplicate hash_selector.go (build tags handle switching)
- Fix benchmark to use worker.DirOverallSHA256Hex
- Fix snapshot_store.go to use integrity.DirOverallSHA256Hex directly
- Native tests pass, benchmarks now correctly test native vs Go
This commit is contained in:
Jeremie Fraeys 2026-02-21 14:26:48 -05:00
parent 90d702823b
commit 158c525bef
No known key found for this signature in database
3 changed files with 3 additions and 21 deletions

View file

@ -1,19 +0,0 @@
package worker
import (
"github.com/jfraeys/fetch_ml/internal/worker/integrity"
)
// dirOverallSHA256Hex uses native implementation when compiled with -tags native_libs.
// The build tag selects between native_bridge.go (stub) and native_bridge_libs.go (real).
// No runtime configuration needed - build determines behavior.
func dirOverallSHA256Hex(root string) (string, error) {
// native_bridge_libs.go provides this when built with -tags native_libs
// native_bridge.go provides stub that falls back to Go
return dirOverallSHA256HexNative(root)
}
// DirOverallSHA256HexParallel exports the parallel directory hashing function.
func DirOverallSHA256HexParallel(root string) (string, error) {
return integrity.DirOverallSHA256HexParallel(root)
}

View file

@ -173,7 +173,7 @@ func ResolveSnapshot(
return "", err
}
got, err := dirOverallSHA256Hex(extractDir)
got, err := integrity.DirOverallSHA256Hex(extractDir)
if err != nil {
return "", err
}

View file

@ -48,7 +48,8 @@ func BenchmarkDatasetSizeComparison(b *testing.B) {
b.ResetTimer()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
_, err := worker.DirOverallSHA256HexParallel(tmpDir)
// Use DirOverallSHA256Hex which calls native via build tag
_, err := worker.DirOverallSHA256Hex(tmpDir)
if err != nil {
b.Fatal(err)
}