**Worker Refactoring:** - Update internal/worker/factory.go, worker.go, snapshot_store.go - Update native_bridge.go and native_bridge_nocgo.go for native library integration **Test Updates:** - Update all worker unit tests for new interfaces - Update chaos tests - Update container/podman_test.go - Add internal/workertest/worker.go for shared test utilities **Documentation:** - Update native/README.md
62 lines
1.9 KiB
Go
62 lines
1.9 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() {
|
|
log.Printf("[native] Native libraries disabled (build with -tags native_libs to enable)")
|
|
}
|
|
|
|
// 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")
|
|
}
|
|
|
|
// DirOverallSHA256HexNative is disabled without native_libs build tag.
|
|
func DirOverallSHA256HexNative(root string) (string, error) {
|
|
return "", errors.New("native hash requires native_libs build tag")
|
|
}
|