model

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: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RefNone identifies base reference
	RefNone = "base"
	// RefSoft identifies soft reference
	RefSoft = "soft"
	// RefHard identifies hard reference
	RefHard = "hard"
)
View Source
const (
	// TypeNone ...
	TypeNone = "base"

	// TypeCosignSignature ...
	TypeCosignSignature = "signature.cosign"

	// TypeNotationSignature ...
	TypeNotationSignature = "signature.notation"

	// TypeNydusAccelerator ...
	TypeNydusAccelerator = "accelerator.nydus"

	// TypeSubject ...
	TypeSubject = "subject.accessory"

	// TypeHarborSBOM identifies sbom.harbor
	TypeHarborSBOM = "sbom.harbor"
)

Variables

This section is empty.

Functions

func Register

func Register(typ string, factory NewAccessoryFunc)

Register accessory factory for type

Types

type Accessory

type Accessory interface {
	RefProvider
	RefIdentifier
	// Display Define whether shows in the artifact list response.
	Display() bool
	GetData() AccessoryData
}

Accessory Independent, but linked to an existing subject artifact, which enabling the extensibility of an OCI artifact

func New

func New(typ string, data AccessoryData) (Accessory, error)

New returns accessory instance

func ToAccessory

func ToAccessory(acc []byte) (Accessory, error)

ToAccessory converts json object to Accessory

type AccessoryData

type AccessoryData struct {
	ID                int64     `json:"id"`
	ArtifactID        int64     `json:"artifact_id"`
	SubArtifactID     int64     `json:"subject_artifact_id"`
	SubArtifactRepo   string    `json:"subject_artifact_repo"`
	SubArtifactDigest string    `json:"subject_artifact_digest"`
	Type              string    `json:"type"`
	Size              int64     `json:"size"`
	Digest            string    `json:"digest"`
	CreatTime         time.Time `json:"creation_time"`
	Icon              string    `json:"icon"`
}

AccessoryData ...

type NewAccessoryFunc

type NewAccessoryFunc func(data AccessoryData) Accessory

NewAccessoryFunc takes data to return a Accessory.

type RefIdentifier

type RefIdentifier interface {
	// IsSoft indicates that the linkage of artifact and its accessory is soft reference.
	IsSoft() bool

	// IsHard indicates that the linkage of artifact and its accessory is hard reference.
	IsHard() bool
}

RefIdentifier

Soft reference: The accessory is not tied to the subject manifest. Hard reference: The accessory is tied to the subject manifest.

Deletion

1. Soft Reference: If the linkage is Soft Reference, when the subject artifact is removed, the linkage will be removed as well, the accessory artifact becomes an individual artifact. 2. Hard Reference: If the linkage is Hard Reference, the accessory artifact will be removed together with the subject artifact.

Garbage Collection

1. Soft Reference: If the linkage is Soft Reference, Harbor treats the accessory as normal artifact and will not set it as the GC candidate. 2. Hard Reference: If the linkage is Hard Reference, Harbor treats the accessory as an extra stuff of the subject artifact. It means, it being tied to the subject artifact and will be GCed whenever the subject artifact is marked and deleted.

type RefProvider

type RefProvider interface {
	// Kind returns reference Kind.
	Kind() string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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