definition

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxCollectionMembers      = 100_000
	MaxPortableMediaTypeBytes = 256
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CollectionDefinition added in v0.2.13

type CollectionDefinition struct {
	Digest         cryptoutil.Digest       `json:"digest,omitempty"`
	Kind           basespec.CollectionKind `json:"kind"`
	SchemaID       basespec.SchemaID       `json:"schemaID"`
	SchemaVersion  string                  `json:"schemaVersion"`
	LogicalName    basespec.LogicalName    `json:"logicalName"`
	LogicalVersion basespec.LogicalVersion `json:"logicalVersion,omitempty"`
	DisplayName    string                  `json:"displayName,omitempty"`
	Description    string                  `json:"description,omitempty"`
	Labels         map[string]string       `json:"labels,omitempty"`
	Body           json.RawMessage         `json:"body"`
	Members        []ContentRef            `json:"members,omitempty"`
}

CollectionDefinition is the generic portable envelope for a shareable Collection. Its Body remains domain-owned, while Members remain visible to generic transfer and integrity code.

func CanonicalizeCollectionDefinition added in v0.2.13

func CanonicalizeCollectionDefinition(
	input CollectionDefinition,
) (CollectionDefinition, error)

CanonicalizeCollectionDefinition returns an independently owned canonical portable Collection Definition and verifies a supplied digest when present.

func (CollectionDefinition) Clone added in v0.2.13

func (CollectionDefinition) Validate added in v0.2.13

func (d CollectionDefinition) Validate() error

type ContentRef added in v0.2.13

type ContentRef struct {
	Locator            basespec.Locator            `json:"locator,omitempty"`
	URI                string                      `json:"uri,omitempty"`
	SubresourceLocator basespec.SubresourceLocator `json:"subresourceLocator,omitempty"`
	Digest             *cryptoutil.Digest          `json:"digest,omitempty"`
	MediaType          string                      `json:"mediaType,omitempty"`
	Role               string                      `json:"role,omitempty"`
}

ContentRef identifies portable member content. Locator is relative to the containing document or package root. URI is an external portable acquisition reference and must be resolved by an explicit policy-controlled resolver.

When Locator and URI are empty, SubresourceLocator identifies embedded content in the containing document.

func (ContentRef) Clone added in v0.2.13

func (r ContentRef) Clone() ContentRef

func (ContentRef) Validate added in v0.2.13

func (r ContentRef) Validate() error

type Definition

type Definition struct {
	Digest         cryptoutil.Digest       `json:"digest"`
	Kind           basespec.ArtifactKind   `json:"kind"`
	SchemaID       basespec.SchemaID       `json:"schemaID"`
	SchemaVersion  string                  `json:"schemaVersion"`
	LogicalName    basespec.LogicalName    `json:"logicalName"`
	LogicalVersion basespec.LogicalVersion `json:"logicalVersion,omitempty"`
	DisplayName    string                  `json:"displayName,omitempty"`
	Description    string                  `json:"description,omitempty"`
	Labels         map[string]string       `json:"labels,omitempty"`
	Body           json.RawMessage         `json:"body"`
	Dependencies   []Selector              `json:"dependencies,omitempty"`
}

Definition is an immutable, content-addressed Artifact definition. Portable collection descriptor documents use CollectionDefinition instead.

func Canonicalize

func Canonicalize(input Definition) (Definition, error)

func ReadCanonical

func ReadCanonical(
	ctx context.Context,
	reader Reader,
	rootID basespec.RootID,
	digest cryptoutil.Digest,
) (Definition, error)

ReadCanonical reads a definition through a Reader and establishes the ownership and integrity guarantees required by consumers.

The returned definition is canonical, independently owned, valid, and has the digest requested by the caller.

func (Definition) Validate

func (d Definition) Validate() error

type Reader

type Reader interface {
	Get(
		ctx context.Context,
		rootID basespec.RootID,
		digest cryptoutil.Digest,
	) (Definition, error)
}

type Repository

type Repository interface {
	Reader
	Writer
}

type RootScopedRepository added in v0.2.13

type RootScopedRepository struct {
	// contains filtered or unexported fields
}

RootScopedRepository enforces Root reachability before delegating immutable definition reads and writes to a content repository.

This prevents a digest and a guessed RootID from becoming an authorization bypass after a Root has been retired or purged.

func NewRootScopedRepository added in v0.2.13

func NewRootScopedRepository(
	repository Repository,
	validateRoot RootValidator,
) (*RootScopedRepository, error)

func (*RootScopedRepository) Get added in v0.2.13

func (*RootScopedRepository) Put added in v0.2.13

func (r *RootScopedRepository) Put(
	ctx context.Context,
	rootID basespec.RootID,
	value Definition,
) (Definition, error)

type RootValidator added in v0.2.13

type RootValidator func(
	ctx context.Context,
	rootID basespec.RootID,
) error

RootValidator establishes whether a Root remains reachable for definition access. The system composition supplies an active-Root validator without coupling the definition package to one metadata implementation.

type Selector

type Selector struct {
	Kind              basespec.ArtifactKind `json:"kind"`
	LogicalName       basespec.LogicalName  `json:"logicalName,omitempty"`
	VersionConstraint string                `json:"versionConstraint,omitempty"`
	Labels            map[string]string     `json:"labels,omitempty"`
}

func (Selector) Validate

func (s Selector) Validate() error

type Writer

type Writer interface {
	Put(
		ctx context.Context,
		rootID basespec.RootID,
		value Definition,
	) (Definition, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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