model

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 2 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 model holds the records strata indexes: images, tags, layers, referrers and lineage edges.

Index

Constants

View Source
const (
	KindSBOM        = "sbom"
	KindSignature   = "signature"
	KindAttestation = "attestation"
	KindOther       = "other"
)

Referrer kinds.

View Source
const (
	SourceLayers      = "layers"
	SourceAttestation = "attestation"
	SourceAnnotation  = "annotation"
	SourceLabel       = "label"
)

Edge sources, strongest first.

View Source
const (
	ConfidenceExact    = "exact"
	ConfidenceDeclared = "declared"
	ConfidenceInferred = "inferred"
)

Edge confidences.

View Source
const PhantomPrefix = "phantom:"

PhantomPrefix marks a node ID that stands for a deleted ancestor, keyed by its chain ID rather than a manifest digest.

Variables

This section is empty.

Functions

func ClassifyArtifact

func ClassifyArtifact(artifactType string) string

ClassifyArtifact maps an OCI artifact type to sbom, signature, attestation or other.

func IsPhantom

func IsPhantom(id string) bool

IsPhantom reports whether id names a phantom ancestor.

Types

type BaseRef added in v0.3.1

type BaseRef struct {
	Digest     string `json:"digest"`
	Ref        string `json:"ref"`
	BaseDigest string `json:"base_digest"`
}

BaseRef is a base image a build says an image was built from, such as a FROM image recorded in BuildKit provenance. Ref names it as repo:tag, and BaseDigest is the digest the build resolved it to, which may be a multi-platform index.

func (BaseRef) FetchRef added in v0.3.1

func (b BaseRef) FetchRef() string

FetchRef returns the ref to fetch the base by: repo@digest when the digest is known, else the ref.

type Config

type Config struct {
	User        string            `json:"user"`
	Entrypoint  []string          `json:"entrypoint"`
	Cmd         []string          `json:"cmd"`
	Ports       []string          `json:"ports"`
	EnvKeys     []string          `json:"env_keys"`
	EnvValues   map[string]string `json:"env_values,omitempty"`
	Workdir     string            `json:"workdir"`
	StopSignal  string            `json:"stop_signal"`
	Healthcheck bool              `json:"healthcheck"`
}

Config holds the run-time fields of an image config that strata indexes under config.*. Environment values are never kept, only keys, except for keys on the allowlist.

type Edge

type Edge struct {
	Child      string `json:"child"`
	Parent     string `json:"parent"`
	Source     string `json:"source"`
	Confidence string `json:"confidence"`
	Evidence   string `json:"evidence"`
}

Edge is a child-to-parent lineage link with its provenance.

type HistoryEntry

type HistoryEntry struct {
	CreatedBy  string `json:"created_by"`
	EmptyLayer bool   `json:"empty_layer"`
}

HistoryEntry is one build step from the image config's history.

type Image

type Image struct {
	Digest       string            `json:"digest"`
	Repo         string            `json:"repo"`
	MediaType    string            `json:"media_type"`
	IndexDigest  string            `json:"index_digest,omitempty"`
	Platform     Platform          `json:"platform"`
	Created      time.Time         `json:"created"`
	Size         int64             `json:"size"`
	ConfigDigest string            `json:"config_digest"`
	Labels       map[string]string `json:"labels"`
	Annotations  map[string]string `json:"annotations"`
	Config       Config            `json:"config"`
	History      []HistoryEntry    `json:"history,omitempty"`
	Layers       []Layer           `json:"layers"`
	ChainIDs     []string          `json:"chain_ids"`
	External     bool              `json:"external,omitempty"`
}

Image is one platform manifest and its config.

func (*Image) Metadata

func (i *Image) Metadata() map[string]string

Metadata merges config labels and manifest annotations into the single map strata stores and queries as label.*. Labels win on conflict, because they are what the image itself declares.

func (*Image) TopChainID

func (i *Image) TopChainID() string

TopChainID returns the chain ID of the image's full layer stack.

type IndexEntry

type IndexEntry struct {
	IndexDigest string
	Digest      string
	Platform    Platform
}

IndexEntry links a multi-platform index to one of its platform manifests.

type Layer

type Layer struct {
	DiffID     string `json:"diff_id"`
	BlobDigest string `json:"blob_digest"`
	Size       int64  `json:"size"`
	MediaType  string `json:"media_type"`
	CreatedBy  string `json:"created_by,omitempty"`
}

Layer is one entry in an image's layer stack.

type Platform

type Platform struct {
	OS      string `json:"os"`
	Arch    string `json:"arch"`
	Variant string `json:"variant,omitempty"`
}

Platform identifies the OS and CPU an image runs on.

func (Platform) String

func (p Platform) String() string

String formats the platform as os/arch[/variant].

type Push added in v0.2.0

type Push struct {
	Repo       string    `json:"repo"`
	Digest     string    `json:"digest"`
	PushedAt   time.Time `json:"pushed_at"`
	LastPulled time.Time `json:"last_pulled"`
}

Push is what a registry's own API reports about one manifest in one repo: when it was pushed and when it was last pulled. Zero times are unknown.

type Referrer

type Referrer struct {
	Subject      string `json:"subject"`
	Digest       string `json:"digest"`
	ArtifactType string `json:"artifact_type"`
	Kind         string `json:"kind"`
}

Referrer is an artifact attached to an image, such as an SBOM or a signature.

type Tag

type Tag struct {
	Repo      string    `json:"repo"`
	Tag       string    `json:"tag"`
	Digest    string    `json:"digest"`
	UpdatedAt time.Time `json:"updated_at"`
}

Tag is where a tag points now.

func (Tag) Ref

func (t Tag) Ref() string

Ref formats the tag as repo:tag.

type TagEvent

type TagEvent struct {
	Repo   string    `json:"repo"`
	Tag    string    `json:"tag"`
	SeenAt time.Time `json:"seen_at"`
	Digest string    `json:"digest"`
	Source string    `json:"source"`
}

TagEvent is one observation of a tag moving, recorded in tag history. An empty Digest means the tag was deleted.

Jump to

Keyboard shortcuts

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