blob

package
v0.0.0-...-e417875 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Mgr default blob manager
	Mgr = NewManager()
)

Functions

This section is empty.

Types

type Blob

type Blob = models.Blob

Blob alias `models.Blob` to make it natural to use the Manager

type Manager

type Manager interface {
	// AssociateWithArtifact associate blob with artifact
	AssociateWithArtifact(ctx context.Context, blobDigest, artifactDigest string) (int64, error)

	// AssociateWithProject associate blob with project
	AssociateWithProject(ctx context.Context, blobID, projectID int64) (int64, error)

	// CalculateTotalSizeByProject returns total blob size by project, skip foreign blobs when `excludeForeignLayer` is true
	CalculateTotalSizeByProject(ctx context.Context, projectID int64, excludeForeignLayer bool) (int64, error)

	// SumBlobsSize returns sum size of all blobs skip foreign blobs when `excludeForeignLayer` is true
	CalculateTotalSize(ctx context.Context, excludeForeignLayer bool) (int64, error)

	// Create create blob
	Create(ctx context.Context, digest string, contentType string, size int64) (int64, error)

	// CleanupAssociationsForArtifact remove all associations between blob and artifact by artifact digest
	CleanupAssociationsForArtifact(ctx context.Context, artifactDigest string) error

	// CleanupAssociationsForProject remove unneeded associations between blobs and project
	CleanupAssociationsForProject(ctx context.Context, projectID int64, blobs []*Blob) error

	// FindBlobsShouldUnassociatedWithProject filter the blobs which should not be associated with the project
	FindBlobsShouldUnassociatedWithProject(ctx context.Context, projectID int64, blobs []*models.Blob) ([]*models.Blob, error)

	// Get get blob by digest
	Get(ctx context.Context, digest string) (*Blob, error)

	// Get get blob by artifact digest
	GetByArt(ctx context.Context, digest string) ([]*models.Blob, error)

	// Update the blob
	Update(ctx context.Context, blob *Blob) error

	// Update the blob status
	UpdateBlobStatus(ctx context.Context, blob *models.Blob) (int64, error)

	// List returns blobs by params
	List(ctx context.Context, query *q.Query) ([]*Blob, error)

	// DeleteBlob delete blob
	Delete(ctx context.Context, id int64) (err error)

	// UselessBlobs useless blob is the blob that is not used in any of projects.
	UselessBlobs(ctx context.Context, timeWindowHours int64) ([]*models.Blob, error)
}

Manager interface provide the management functions for blobs

func NewManager

func NewManager() Manager

NewManager returns blob manager

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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