artifact

package
v0.0.0-...-29bd094 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 9 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	ID                int64                  `json:"id"`
	Type              string                 `json:"type"`                // image, chart or other OCI compatible
	MediaType         string                 `json:"media_type"`          // the media type of artifact. Mostly, it's the value of `manifest.config.mediatype`
	ManifestMediaType string                 `json:"manifest_media_type"` // the media type of manifest/index
	ArtifactType      string                 `json:"artifact_type"`       // the artifactType of manifest/index
	ProjectID         int64                  `json:"project_id"`
	RepositoryID      int64                  `json:"repository_id"`
	RepositoryName    string                 `json:"repository_name"`
	Digest            string                 `json:"digest"`
	Size              int64                  `json:"size"`
	Icon              string                 `json:"icon"`
	PushTime          time.Time              `json:"push_time"`
	PullTime          time.Time              `json:"pull_time"`
	ExtraAttrs        map[string]interface{} `json:"extra_attrs"` // only contains the simple attributes specific for the different artifact type, most of them should come from the config layer
	Annotations       map[string]string      `json:"annotations"`
	References        []*Reference           `json:"references"` // child artifacts referenced by the parent artifact if the artifact is an index
}

Artifact is the abstract object managed by Harbor. It hides the underlying concrete detail and provides an unified artifact view for all users.

func (*Artifact) From

func (a *Artifact) From(art *dao.Artifact)

From converts the database level artifact to the business level object

func (*Artifact) IsImageIndex

func (a *Artifact) IsImageIndex() bool

IsImageIndex returns true when artifact is image index

func (*Artifact) String

func (a *Artifact) String() string

func (*Artifact) To

func (a *Artifact) To() *dao.Artifact

To converts the artifact to the database level object

type Manager

type Manager interface {
	// Count returns the total count of artifacts according to the query.
	// The artifacts that referenced by others and without tags are not counted
	Count(ctx context.Context, query *q.Query) (total int64, err error)
	// List artifacts according to the query. The artifacts that referenced by others and
	// without tags are not returned
	List(ctx context.Context, query *q.Query) (artifacts []*Artifact, err error)
	// Get the artifact specified by the ID
	Get(ctx context.Context, id int64) (artifact *Artifact, err error)
	// GetByDigest returns the artifact specified by repository and digest
	GetByDigest(ctx context.Context, repository, digest string) (artifact *Artifact, err error)
	// Create the artifact. If the artifact is an index, make sure all the artifacts it references
	// already exist
	Create(ctx context.Context, artifact *Artifact) (id int64, err error)
	// Delete just deletes the artifact record. The underlying data of registry will be
	// removed during garbage collection
	Delete(ctx context.Context, id int64) (err error)
	// Update the artifact. Only the properties specified by "props" will be updated if it is set
	Update(ctx context.Context, artifact *Artifact, props ...string) (err error)
	// UpdatePullTime updates artifact pull time by ID.
	UpdatePullTime(ctx context.Context, id int64, pullTime time.Time) (err error)
	// ListReferences according to the query
	ListReferences(ctx context.Context, query *q.Query) (references []*Reference, err error)
	// DeleteReference specified by ID
	DeleteReference(ctx context.Context, id int64) (err error)
	// ListWithLatest list the artifacts when the latest_in_repository in the query was set
	ListWithLatest(ctx context.Context, query *q.Query) (artifacts []*Artifact, err error)
}

Manager is the only interface of artifact module to provide the management functions for artifacts

func NewManager

func NewManager() Manager

NewManager returns an instance of the default manager

type Reference

type Reference struct {
	ID          int64  `json:"id"`
	ParentID    int64  `json:"parent_id"`
	ChildID     int64  `json:"child_id"`
	ChildDigest string `json:"child_digest"`
	Platform    *v1.Platform
	URLs        []string          `json:"urls"`
	Annotations map[string]string `json:"annotations"`
}

Reference records the child artifact referenced by parent artifact

func (*Reference) From

func (r *Reference) From(ref *dao.ArtifactReference)

From converts the data level reference to business level

func (*Reference) To

func (r *Reference) To() *dao.ArtifactReference

To converts the reference to data level object

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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