Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultCleanupWindowSeconds = 86400
)
View Source
var DefaultSelector = Default()
View Source
var (
Mgr = NewManager()
)
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager interface { // Create a system artifact described by artifact record. // The reader would be used to read from the underlying data artifact. // Returns a system artifact tracking record id or any errors encountered in the data artifact upload process. // Invoking this API would result in a repository being created with the specified name and digest within the registry. Create(ctx context.Context, artifactRecord *model.SystemArtifact, reader io.Reader) (int64, error) // Read a system artifact described by repository name and digest. // The reader is responsible for closing the IO stream after the read completes. Read(ctx context.Context, vendor string, repository string, digest string) (io.ReadCloser, error) // Delete deletes a system artifact identified by a repository name and digest. // Also deletes the tracking record from the underlying table. Delete(ctx context.Context, vendor string, repository string, digest string) error // Exists checks for the existence of a system artifact identified by repository and digest. // A system artifact is considered as in existence if both the following conditions are true: // 1. There is a system artifact tracking record within the Harbor DB // 2. There is a BLOB corresponding to the repository name and digest obtained from system artifact record. Exists(ctx context.Context, vendor string, repository string, digest string) (bool, error) // GetStorageSize returns the total disk space used by the system artifacts stored in the registry. GetStorageSize(ctx context.Context) (int64, error) // RegisterCleanupCriteria a clean-up criteria for a specific vendor and artifact type combination. RegisterCleanupCriteria(vendor string, artifactType string, criteria Selector) // GetCleanupCriteria returns a clean-up criteria for a specific vendor and artifact type combination. // if no clean-up criteria is found then the default clean-up criteria is returned GetCleanupCriteria(vendor string, artifactType string) Selector // Cleanup cleans up the system artifacts (tracking records as well as blobs) based on the // artifact records selected by the Selector registered for each vendor type. // Returns the total number of records deleted, the reclaimed size and any error (if encountered) Cleanup(ctx context.Context) (int64, int64, error) // GetSystemArtifactProjectNames returns a list of project names that are reserved // to be used by the system artifact manager for creation of system artifacts. GetSystemArtifactProjectNames() []string }
Manager provides a low-level interface for harbor services to create registry artifacts containing arbitrary data but which are not standard OCI artifacts. By using this framework, harbor components can create artifacts for cross component data sharing. The framework abstracts out the book-keeping logic involved in managing and tracking system artifacts. The Manager ultimately relies on the harbor registry client to perform the BLOB related operations into the registry.
func NewManager ¶
func NewManager() Manager
type Selector ¶
type Selector interface { // List all system artifacts created greater than 24 hours. List(ctx context.Context) ([]*model.SystemArtifact, error) // ListWithFilters allows retrieval of system artifact records that match // multiple filter and sort criteria that can be specified by the clients ListWithFilters(ctx context.Context, query *q.Query) ([]*model.SystemArtifact, error) }
Click to show internal directories.
Click to hide internal directories.