Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Ctl is a global blob controller instance Ctl = NewController() )
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller interface { // AssociateWithArtifact associate blobs with manifest. AssociateWithArtifact(ctx context.Context, blobDigests []string, artifactDigest string) error // AssociateWithProjectByID associate blob with project by blob id AssociateWithProjectByID(ctx context.Context, blobID int64, projectID int64) error // AssociateWithProjectByDigest associate blob with project by blob digest AssociateWithProjectByDigest(ctx context.Context, blobDigest string, projectID int64) error // CalculateTotalSizeByProject returns the sum of the blob size for the project CalculateTotalSizeByProject(ctx context.Context, projectID int64, excludeForeign bool) (int64, error) // CalculateTotalSize returns the sum of all the blobs size CalculateTotalSize(ctx context.Context, excludeForeign bool) (int64, error) // Ensure create blob when it not exist. Ensure(ctx context.Context, digest string, contentType string, size int64) (int64, error) // Exist check blob exist by digest, // it check the blob associated with the artifact when `IsAssociatedWithArtifact` option provided, // and also check the blob associated with the project when `IsAssociatedWithProject` option provied. Exist(ctx context.Context, digest string, options ...Option) (bool, error) // FindMissingAssociationsForProjectByArtifact returns blobs which are associated with artifact but not associated with project FindMissingAssociationsForProject(ctx context.Context, projectID int64, blobs []*blob.Blob) ([]*blob.Blob, error) // Get get the blob by digest, // it check the blob associated with the artifact when `IsAssociatedWithArtifact` option provided, // and also check the blob associated with the project when `IsAssociatedWithProject` option provied. Get(ctx context.Context, digest string, options ...Option) (*blob.Blob, error) // List list blobs List(ctx context.Context, query *q.Query) ([]*blob.Blob, error) // Sync create blobs from `References` when they are not exist // and update the blob content type when they are exist, Sync(ctx context.Context, references []distribution.Descriptor) error // SetAcceptedBlobSize update the accepted size of stream upload blob. SetAcceptedBlobSize(sessionID string, size int64) error // GetAcceptedBlobSize returns the accepted size of stream upload blob. GetAcceptedBlobSize(sessionID string) (int64, error) // Touch updates the blob status to StatusNone and increase version every time. Touch(ctx context.Context, blob *blob.Blob) error // Fail updates the blob status to StatusDeleteFailed and increase version every time. Fail(ctx context.Context, blob *blob.Blob) error // Update updates the blob, it cannot handle blob status transitions. Update(ctx context.Context, blob *blob.Blob) error // Delete deletes the blob by its id Delete(ctx context.Context, id int64) error }
Controller defines the operations related with blobs
func NewController ¶
func NewController() Controller
NewController creates an instance of the default repository controller
type Option ¶
type Option func(*Options)
Option option for `Get` and `Exist` method of `Controller`
func IsAssociatedWithArtifact ¶
IsAssociatedWithArtifact set ArtifactDigest for the Options
func IsAssociatedWithProject ¶
IsAssociatedWithProject set ProjectID for the Options
Click to show internal directories.
Click to hide internal directories.