Documentation
¶
Overview ¶
Package artifact describes what data is, without storage or execution semantics.
Index ¶
Constants ¶
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 ¶
var (
ErrInvalidArtifact = errors.New("invalid artifact")
)
var (
ErrNonCanonicalEncoding = errors.New("non-canonical artifact encoding")
)
Functions ¶
func CanonicalDigest ¶
CanonicalDigest returns the SHA-256 digest of EncodeArtifact output.
func EncodeArtifact ¶
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 ¶
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.
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.
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.