artifact

package
v1.0.0-beta.20 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package artifact defines artifact metadata shared by the engine and CLI.

Index

Constants

View Source
const ModuleDimension = "module"

Variables

This section is empty.

Functions

func IsStaticDimension

func IsStaticDimension(identifier string) bool

IsStaticDimension identifies keys available without loading collections.

func MatchTypeKey

func MatchTypeKey(candidates []string, key string) []string

MatchTypeKey lists the candidates a type key names: the path it equals, and each path it is a suffix of, on segment boundaries. A leading "/" accepts only a full path.

func ResolveTypeKey

func ResolveTypeKey(candidates Paths, name, key string) ([]string, error)

ResolveTypeKey lists the full paths a type key selects among candidates. A key that names several paths selects them all, such as every staleness check. But a key that names both an operation on each item of a collection and the same operation on the collection's batch, such as up on each service and up on a batch of services, would run it twice: that is an error that lists the paths, never their union.

func ShortTypeKey

func ShortTypeKey(candidates []string, path string) string

ShortTypeKey is the shortest suffix of path that names only path among the candidates. Without one, it is the full path, or the full path with a leading "/" when that is also the suffix of a longer candidate. It is a projection: adding a path to the schema can lengthen it.

Types

type Dimension

type Dimension struct {
	Kind           string
	CollectionType string
	Identifier     string `field:"true" doc:"Stable identifier: collection schema path, type:TypeName for an artifact type, or module."`
	Name           string `field:"true" doc:"Short name used to select this dimension."`
	QualifiedName  string `field:"true" doc:"Qualified name used when the short name is ambiguous."`
	ItemType       string `field:"true" doc:"The collection item or artifact type name, or empty for the module dimension."`
	KeyName        string `field:"true" doc:"The collection key argument name, or name for a static dimension."`
	KeyDescription string `field:"true" doc:"The collection key argument description, or empty for a static dimension."`
}

Dimension describes a schema axis, independent of its runtime keys.

func (*Dimension) Type

func (*Dimension) Type() *ast.Type

type Dimensions

type Dimensions []*Dimension

Dimensions is the set of dimensions in a selected schema scope.

func Union

func Union(sets ...Dimensions) Dimensions

Union combines dimension sets, sorted by identifier.

func (Dimensions) DisplayName

func (dims Dimensions) DisplayName(dim *Dimension) string

DisplayName returns the shortest unambiguous name for a dimension.

func (Dimensions) Names

func (dims Dimensions) Names(dim *Dimension, wholeCollection bool) []string

Names lists selectors from shortest to most qualified. Collection boundaries provide parent identity; their fields are needed in names only on a conflict.

func (Dimensions) Resolve

func (dims Dimensions) Resolve(name string) (string, error)

Resolve binds an identifier or alias. Unknown names remain valid selectors that match no artifacts.

type Path

type Path struct {
	// Type is the type dimension identifier, such as type:Check.
	Type   string
	Key    string
	Module string
	// Dimensions are collection dimension identifiers, parent to child.
	Dimensions []string
}

Path is one schema path in a type dimension: the full path its type key holds, and the collection dimensions an address for it must key.

type Paths

type Paths []Path

Paths indexes the schema paths of every loaded module, so a type key names one path in a workspace whatever the selection.

func UnionPaths

func UnionPaths(sets ...Paths) Paths

UnionPaths combines path sets, dropping duplicates.

func (Paths) CandidatePaths

func (paths Paths) CandidatePaths(typeDimension string, dimensions, modules []string) Paths

CandidatePaths is Candidates with each path's dimensions.

func (Paths) Candidates

func (paths Paths) Candidates(typeDimension string, dimensions, modules []string) []string

Candidates lists the full paths in a type dimension that an address keying dimensions can name. A path qualifies when it has every one of them. Modules narrow the list when set.

Jump to

Keyboard shortcuts

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