catalog

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

This section is empty.

Variables

This section is empty.

Functions

func EqualOccurrences added in v0.2.13

func EqualOccurrences(left, right []Occurrence) bool

EqualOccurrences compares occurrence values independently of ordering.

func EqualSnapshot added in v0.2.13

func EqualSnapshot(left, right Snapshot) bool

EqualSnapshot compares the semantic contents of two catalog snapshots. Occurrences are compared by occurrence key because their persisted ordering is not part of catalog identity.

func SortOccurrences

func SortOccurrences(values []Occurrence)

Types

type Occurrence

type Occurrence struct {
	RootID              basespec.RootID         `json:"rootID"`
	CollectionID        basespec.CollectionID   `json:"collectionID"`
	Key                 OccurrenceKey           `json:"key"`
	Kind                basespec.ArtifactKind   `json:"kind,omitempty"`
	LogicalName         basespec.LogicalName    `json:"logicalName,omitempty"`
	LogicalVersion      basespec.LogicalVersion `json:"logicalVersion,omitempty"`
	DefinitionDigest    *cryptoutil.Digest      `json:"definitionDigest,omitempty"`
	SourceContentDigest *cryptoutil.Digest      `json:"sourceContentDigest,omitempty"`
	DecoderID           basespec.DecoderID      `json:"decoderID,omitempty"`
	State               OccurrenceState         `json:"state"`
	Diagnostics         []diagnostic.Diagnostic `json:"diagnostics,omitempty"`
	ObservedAt          time.Time               `json:"observedAt"`
}

func CloneOccurrence

func CloneOccurrence(input Occurrence) Occurrence

CloneOccurrence returns an owned copy of an occurrence and all mutable members.

func (Occurrence) Validate

func (o Occurrence) Validate() error

type OccurrenceKey

type OccurrenceKey struct {
	CollectionID       basespec.CollectionID       `json:"collectionID"`
	SourceID           basespec.SourceID           `json:"sourceID"`
	Locator            basespec.Locator            `json:"locator"`
	SubresourceLocator basespec.SubresourceLocator `json:"subresourceLocator,omitempty"`
}

func (OccurrenceKey) Validate

func (k OccurrenceKey) Validate() error

type OccurrenceState

type OccurrenceState string
const (
	OccurrenceValid   OccurrenceState = "valid"
	OccurrenceInvalid OccurrenceState = "invalid"
	OccurrenceMissing OccurrenceState = "missing"
)

type Reader

type Reader interface {
	// GetCurrent returns the latest published snapshot. It may return a valid
	// snapshot together with an error wrapping basespec.ErrCatalogStale
	// when Collection, attachment, or Source metadata has changed.
	GetCurrent(
		ctx context.Context,
		ref collection.CollectionRef,
	) (Snapshot, error)
}

type Snapshot

type Snapshot struct {
	RootID              basespec.RootID              `json:"rootID"`
	CollectionID        basespec.CollectionID        `json:"collectionID"`
	Revision            uint64                       `json:"revision"`
	CollectionRevision  uint64                       `json:"collectionRevision"`
	AttachmentRevisions map[basespec.SourceID]uint64 `json:"attachmentRevisions"`
	SourceRevisions     map[basespec.SourceID]uint64 `json:"sourceRevisions"`
	SourceGenerations   map[basespec.SourceID]string `json:"sourceGenerations"`
	PlanFingerprint     cryptoutil.Digest            `json:"planFingerprint"`
	DecoderFingerprint  cryptoutil.Digest            `json:"decoderFingerprint"`
	PublishedAt         time.Time                    `json:"publishedAt"`
	Diagnostics         []diagnostic.Diagnostic      `json:"diagnostics,omitempty"`
	Occurrences         []Occurrence                 `json:"occurrences"`
}

func CloneSnapshot

func CloneSnapshot(input Snapshot) Snapshot

CloneSnapshot returns an owned copy of a snapshot and all mutable members.

func ReadCurrent added in v0.2.13

func ReadCurrent(
	ctx context.Context,
	reader Reader,
	ref collection.CollectionRef,
) (Snapshot, error)

ReadCurrent establishes the ownership, identity, and validation guarantees required by catalog consumers. A stale catalog remains readable because it is still useful for diagnostics and refresh reconciliation.

func (Snapshot) Validate

func (s Snapshot) Validate() error

Jump to

Keyboard shortcuts

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