manifest

package
v0.0.0-...-f30a32e Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrArtifactNotFound = errors.New("no artifact with given version")

ErrArtifactNotFound is returned when the version of an artifact requested is not found within the requested artifact set.

View Source
var ErrArtifactSetNotFound = errors.New("no artifact set with given artifact name")

ErrArtifactSetNotFound is returned when an artifact is requested for an artifact set that's not in the manifest.

Functions

This section is empty.

Types

type ArtifactFilter

type ArtifactFilter func(*versionspb.Artifact) bool

ArtifactFilter filters artifacts for a ListArtifacts call. Returning true means the artifact should be kept.

func ArtifactTypeFilter

func ArtifactTypeFilter(at versionspb.ArtifactType) ArtifactFilter

ArtifactTypeFilter filters out any artifacts that don't have the specified ArtifactType available.

func RemovePrereleasesFilter

func RemovePrereleasesFilter() ArtifactFilter

RemovePrereleasesFilter filters out any artifacts that are for prerelease versions.

type ArtifactManifest

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

ArtifactManifest represents a manifest file listing artifact sets. Internally, the artifacts are sorted by their versions, with newer versions first.

func NewArtifactManifestFromProto

func NewArtifactManifestFromProto(pb []*versionspb.ArtifactSet) *ArtifactManifest

NewArtifactManifestFromProto returns a new ArtifactManifest from a list of ArtifactSet protobufs.

func ReadArtifactManifest

func ReadArtifactManifest(r io.Reader) (*ArtifactManifest, error)

ReadArtifactManifest reads an ArtifactManifest from a json stream.

func (*ArtifactManifest) ArtifactSets

func (a *ArtifactManifest) ArtifactSets() []*versionspb.ArtifactSet

ArtifactSets returns the list of protobuf artifact sets in this manifest.

func (*ArtifactManifest) GetArtifact

func (m *ArtifactManifest) GetArtifact(name string, version string) (*versionspb.Artifact, error)

GetArtifact returns a an artifact with the given artifact name and version string.

func (*ArtifactManifest) ListArtifacts

func (m *ArtifactManifest) ListArtifacts(name string, limit int64, filters ...ArtifactFilter) ([]*versionspb.Artifact, error)

ListArtifacts returns artifacts with the given name, in version sorted order (newest versions first). It returns up to `limit` artifacts.

func (*ArtifactManifest) MarshalJSON

func (a *ArtifactManifest) MarshalJSON() ([]byte, error)

MarshalJSON marshals a slice of artifact sets into a json array.

func (*ArtifactManifest) Merge

Merge returns a new ArtifactManifest with the artifacts merged. On conflicts, values in `updates` take precedence.

func (*ArtifactManifest) UnmarshalJSON

func (a *ArtifactManifest) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a json array of artifact sets into an ArtifactManifest.

func (*ArtifactManifest) Write

func (a *ArtifactManifest) Write(w io.Writer) error

Write writes an artifact manifest in JSON format to the given io.Writer.

type CallbackFn

type CallbackFn func(*ArtifactManifest) error

CallbackFn is the type for the callback that will be called whenever the manifest changes.

type Location

type Location interface {
	Checksum(context.Context) ([]byte, error)
	ManifestReader(context.Context) (io.ReadCloser, error)
}

Location represents a storage location of a manifest, and allows interacting with it.

func NewGCSLocation

func NewGCSLocation(client *storage.Client, bucket string, manifestPath string) Location

NewGCSLocation creates a new manifest.Location for a manifest stored in GCS.

func NewHTTPLocation

func NewHTTPLocation(shaURL string, manifestURL string) Location

NewHTTPLocation returns a new Location for a manifest stored at an arbitrary http endpoint.

type Poller

type Poller interface {
	Start() error
	Stop()
}

Poller polls for manifest changes, and calls a callback whenever a new manifest is uploaded.

func NewPoller

func NewPoller(loc Location, pollPeriod time.Duration, cb CallbackFn) Poller

NewPoller creates a new Poller to poll for manifest changes.

Jump to

Keyboard shortcuts

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