mirror of
https://github.com/anchore/syft.git
synced 2026-07-05 02:28:25 +02:00
remove oci artifact interface
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
parent
dbf6dd2eb3
commit
b85b50001d
@ -14,7 +14,6 @@ import (
|
|||||||
|
|
||||||
var _ Resolver = (*MockResolver)(nil)
|
var _ Resolver = (*MockResolver)(nil)
|
||||||
var _ OCIMediaTypeResolver = (*MockResolver)(nil)
|
var _ OCIMediaTypeResolver = (*MockResolver)(nil)
|
||||||
var _ OCIArtifactResolver = (*MockResolver)(nil)
|
|
||||||
|
|
||||||
// MockResolver implements the FileResolver interface and is intended for use *only in test code*.
|
// MockResolver implements the FileResolver interface and is intended for use *only in test code*.
|
||||||
// It provides an implementation that can resolve local filesystem paths using only a provided discrete list of file
|
// It provides an implementation that can resolve local filesystem paths using only a provided discrete list of file
|
||||||
|
|||||||
@ -63,17 +63,6 @@ type OCIMediaTypeResolver interface {
|
|||||||
FilesByMediaType(types ...string) ([]Location, error)
|
FilesByMediaType(types ...string) ([]Location, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// OCIArtifactResolver exposes the user-supplied OCI image reference to
|
|
||||||
// catalogers. Catalogers can type-assert a Resolver to this interface when they
|
|
||||||
// need a naming or context hint that the layer contents alone don't carry — for
|
|
||||||
// example, when a repacked AI model artifact has stripped name fields out of its
|
|
||||||
// config.json and the only remaining identifier is the image reference itself.
|
|
||||||
type OCIArtifactResolver interface {
|
|
||||||
// ImageReference returns the image reference the artifact was fetched with, e.g.
|
|
||||||
// "docker.io/ai/smollm2-vllm:360M". Returns "" when not known.
|
|
||||||
ImageReference() string
|
|
||||||
}
|
|
||||||
|
|
||||||
// LocationResolver provides iteration over all file locations in a source.
|
// LocationResolver provides iteration over all file locations in a source.
|
||||||
type LocationResolver interface {
|
type LocationResolver interface {
|
||||||
// AllLocations returns a channel of all file references from the underlying source.
|
// AllLocations returns a channel of all file references from the underlying source.
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import (
|
|||||||
|
|
||||||
var _ file.Resolver = (*ContainerImageModel)(nil)
|
var _ file.Resolver = (*ContainerImageModel)(nil)
|
||||||
var _ file.OCIMediaTypeResolver = (*ContainerImageModel)(nil)
|
var _ file.OCIMediaTypeResolver = (*ContainerImageModel)(nil)
|
||||||
var _ file.OCIArtifactResolver = (*ContainerImageModel)(nil)
|
|
||||||
|
|
||||||
// LayerInfo holds information about an OCI model layer file stored on disk.
|
// LayerInfo holds information about an OCI model layer file stored on disk.
|
||||||
type LayerInfo struct {
|
type LayerInfo struct {
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import (
|
|||||||
"github.com/anchore/syft/internal/log"
|
"github.com/anchore/syft/internal/log"
|
||||||
"github.com/anchore/syft/syft/artifact"
|
"github.com/anchore/syft/syft/artifact"
|
||||||
"github.com/anchore/syft/syft/file"
|
"github.com/anchore/syft/syft/file"
|
||||||
|
"github.com/anchore/syft/syft/internal/fileresolver"
|
||||||
"github.com/anchore/syft/syft/pkg"
|
"github.com/anchore/syft/syft/pkg"
|
||||||
"github.com/anchore/syft/syft/pkg/cataloger/internal/licenses"
|
"github.com/anchore/syft/syft/pkg/cataloger/internal/licenses"
|
||||||
)
|
)
|
||||||
@ -417,7 +418,9 @@ func resolveSafeTensorsOCIIdentity(resolver file.Resolver, md *pkg.SafeTensorsMo
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ociImageRefBasename(resolver file.Resolver) string {
|
func ociImageRefBasename(resolver file.Resolver) string {
|
||||||
info, ok := resolver.(file.OCIArtifactResolver)
|
// TODO: we don't think this approach is generalizable quite yet, but we really do need this information.
|
||||||
|
// (Ideally we should be NOT be type asserting on the file resolver directly).
|
||||||
|
info, ok := resolver.(*fileresolver.ContainerImageModel)
|
||||||
if !ok {
|
if !ok {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,6 @@ type ociModelSource struct {
|
|||||||
resolver interface {
|
resolver interface {
|
||||||
file.Resolver
|
file.Resolver
|
||||||
file.OCIMediaTypeResolver
|
file.OCIMediaTypeResolver
|
||||||
file.OCIArtifactResolver
|
|
||||||
}
|
}
|
||||||
mutex *sync.Mutex
|
mutex *sync.Mutex
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user