artifact

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package artifact describes what data is, without storage or execution semantics.

Index

Constants

View Source
const (
	// APIVersion is the only artifact wire version accepted by this package.
	APIVersion = "artifacts.enbu.net/v2alpha1"

	MaxMetadataBytes   = 256 * 1024
	MaxMetadataEntries = 4 * 1024
	MaxMediaTypeBytes  = 1024
	MaxPayloads        = 1024
	MaxArtifactBytes   = 16 * 1024 * 1024
)

Variables

View Source
var (
	ErrInvalidArtifact = errors.New("invalid artifact")
)
View Source
var (
	ErrNonCanonicalEncoding = errors.New("non-canonical artifact encoding")
)

Functions

func CanonicalDigest

func CanonicalDigest(artifact Artifact) (digest.Digest, error)

CanonicalDigest returns the SHA-256 digest of EncodeArtifact output.

func EncodeArtifact

func EncodeArtifact(artifact Artifact) ([]byte, error)

EncodeArtifact returns the sole canonical wire representation of artifact. Payloads are ordered by name without mutating the caller.

Types

type Artifact

type Artifact struct {
	APIVersion string       `cbor:"apiVersion" json:"apiVersion"`
	UID        UUID         `cbor:"uid" json:"uid"`
	Schema     TypeRef      `cbor:"schema" json:"schema"`
	Metadata   Metadata     `cbor:"metadata" json:"metadata"`
	Payloads   []PayloadRef `cbor:"payloads" json:"payloads"`
}

func DecodeArtifact

func DecodeArtifact(data []byte) (Artifact, error)

DecodeArtifact accepts only the exact canonical representation emitted by EncodeArtifact. This prevents alternate encodings from acquiring the same semantic meaning while carrying a different content digest.

func (Artifact) Validate

func (r Artifact) Validate() error

type Metadata

type Metadata struct {
	Name        string            `cbor:"name" json:"name"`
	Labels      map[string]string `cbor:"labels" json:"labels"`
	Annotations map[string]string `cbor:"annotations" json:"annotations"`
}

Metadata contains inert human-facing and classification data.

func (Metadata) Validate

func (m Metadata) Validate() error

type PayloadRef

type PayloadRef struct {
	Name      string        `cbor:"name" json:"name"`
	MediaType string        `cbor:"mediaType" json:"mediaType"`
	Digest    digest.Digest `cbor:"digest" json:"digest"`
	Size      uint64        `cbor:"size" json:"size"`
}

PayloadRef describes a named plaintext stream; its bytes belong outside the IR.

func (PayloadRef) Validate

func (p PayloadRef) Validate() error

type TypeRef

type TypeRef struct {
	Group   string `cbor:"group" json:"group"`
	Version string `cbor:"version" json:"version"`
	Kind    string `cbor:"kind" json:"kind"`
}

TypeRef identifies the schema semantics of an artifact value.

func ParseTypeRef

func ParseTypeRef(value string) (TypeRef, error)

func (TypeRef) String

func (r TypeRef) String() string

func (TypeRef) Validate

func (r TypeRef) Validate() error

type UUID

type UUID string

UUID is a canonical, non-nil RFC 9562 UUID string.

Only lowercase hyphenated values are accepted so a UUID has exactly one wire representation. Versions 1 through 8 using the RFC variant are supported.

func ParseUUID

func ParseUUID(value string) (UUID, error)

func (UUID) Validate

func (u UUID) Validate() error

Jump to

Keyboard shortcuts

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