processor

package
v0.0.0-...-a668890 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ArtifactTypeUnknown defines the type for the unknown artifacts
	ArtifactTypeUnknown = "UNKNOWN"
)

Variables

View Source
var (
	// DefaultProcessor is to process artifact which has no specific processor
	DefaultProcessor = &defaultProcessor{regCli: registry.Cli}
)
View Source
var (
	// Registry for registered artifact processors
	Registry = map[string]Processor{}
)

Functions

func Register

func Register(processor Processor, mediaTypes ...string) error

Register artifact processor, one processor can process multiple media types for one kind of artifact

Types

type Addition

type Addition struct {
	Content     []byte // the content of the addition
	ContentType string // the content type of the addition, returned as "Content-Type" header in API
}

Addition defines the specific addition of different artifacts: build history for image, values.yaml for chart, etc

type Processor

type Processor interface {
	// GetArtifactType returns the type of one kind of artifact specified by media type
	GetArtifactType(ctx context.Context, artifact *artifact.Artifact) string
	// ListAdditionTypes returns the supported addition types of one kind of artifact specified by media type
	ListAdditionTypes(ctx context.Context, artifact *artifact.Artifact) []string
	// AbstractMetadata abstracts the metadata for the specific artifact type into the artifact model,
	// the metadata can be got from the manifest or other layers referenced by the manifest.
	AbstractMetadata(ctx context.Context, artifact *artifact.Artifact, manifest []byte) error
	// AbstractAddition abstracts the addition of the artifact.
	// The additions are different for different artifacts:
	// build history for image;
	AbstractAddition(ctx context.Context, artifact *artifact.Artifact, additionType string) (addition *Addition, err error)
}

Processor processes specified artifact

func Get

func Get(mediaType string) Processor

Get the artifact processor according to the media type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL