- Add arena allocator for zero-allocation hot paths - Add thread pool for parallel operations - Add mmap utilities for memory-mapped I/O - Implement queue_index with heap-based priority queue - Implement dataset_hash with SIMD support (SHA-NI, ARMv8) - Add runtime SIMD detection for cross-platform correctness - Add comprehensive tests and benchmarks
64 lines
2 KiB
Go
64 lines
2 KiB
Go
//go:build cgo && !native_libs
|
|
// +build cgo,!native_libs
|
|
|
|
package worker
|
|
|
|
import (
|
|
"errors"
|
|
"log"
|
|
|
|
"github.com/jfraeys/fetch_ml/internal/manifest"
|
|
"github.com/jfraeys/fetch_ml/internal/queue"
|
|
)
|
|
|
|
func init() {
|
|
// Even with CGO, native libs require explicit build tag
|
|
UseNativeLibs = false
|
|
log.Printf("[native] Native libraries disabled (build with -tags native_libs to enable)")
|
|
}
|
|
|
|
// dirOverallSHA256HexNative is not available without native_libs build tag.
|
|
func dirOverallSHA256HexNative(_ string) (string, error) {
|
|
return "", errors.New("native hash requires native_libs build tag")
|
|
}
|
|
|
|
// HashFilesBatchNative is not available without native_libs build tag.
|
|
func HashFilesBatchNative(paths []string) ([]string, error) {
|
|
return nil, errors.New("native batch hash requires native_libs build tag")
|
|
}
|
|
|
|
// GetSIMDImplName returns "disabled" when native libs aren't built.
|
|
func GetSIMDImplName() string {
|
|
return "disabled"
|
|
}
|
|
|
|
// HasSIMDSHA256 returns false when native libs aren't built.
|
|
func HasSIMDSHA256() bool {
|
|
return false
|
|
}
|
|
|
|
// ScanArtifactsNative is disabled without native_libs build tag.
|
|
func ScanArtifactsNative(runDir string) (*manifest.Artifacts, error) {
|
|
return nil, errors.New("native artifact scanner requires native_libs build tag")
|
|
}
|
|
|
|
// ExtractTarGzNative is disabled without native_libs build tag.
|
|
func ExtractTarGzNative(archivePath, dstDir string) error {
|
|
return errors.New("native tar.gz extractor requires native_libs build tag")
|
|
}
|
|
|
|
// QueueIndexNative is a stub type when native libs aren't built.
|
|
type QueueIndexNative struct{}
|
|
|
|
// OpenQueueIndexNative is not available without native_libs build tag.
|
|
func OpenQueueIndexNative(queueDir string) (*QueueIndexNative, error) {
|
|
return nil, errors.New("native queue index requires native_libs build tag")
|
|
}
|
|
|
|
// Close is a no-op for the stub.
|
|
func (qi *QueueIndexNative) Close() {}
|
|
|
|
// AddTasks is not available without native_libs build tag.
|
|
func (qi *QueueIndexNative) AddTasks(tasks []*queue.Task) error {
|
|
return errors.New("native queue index requires native_libs build tag")
|
|
}
|