Documentation
¶
Overview ¶
Package image manages the built-image catalog: provenance written by the pipeline build step, read APIs for the UI, and a retention GC that never collects a digest a live deployment or pinned release references.
Index ¶
- Variables
- type GCReport
- type RecordInput
- type Remover
- type RetentionPolicy
- type Service
- func (s *Service) ByDigests(workspaceID uint, digests []string) (map[string]models.Image, error)
- func (s *Service) Delete(ctx context.Context, workspaceID, id uint, remover Remover) error
- func (s *Service) GC(ctx context.Context, policy RetentionPolicy, remover Remover) (GCReport, error)
- func (s *Service) Get(workspaceID, id uint) (*models.Image, error)
- func (s *Service) List(workspaceID uint, appID *uint) ([]models.Image, error)
- func (s *Service) ProtectedDigests() (map[string]bool, error)
- func (s *Service) Record(in RecordInput) (*models.Image, error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type GCReport ¶
type GCReport struct {
Deleted int `json:"deleted"`
Protected int `json:"protected"`
FreedBy int64 `json:"freed_bytes"`
}
GCReport summarizes a sweep.
type RecordInput ¶
type RecordInput struct {
WorkspaceID uint
Repository string // repo name, e.g. "miabi/app-5"
Tag string // human tag, e.g. the run number
Digest string // sha256:… (image id for a local-only build)
SizeBytes int64
ApplicationID *uint
PipelineRunID *uint
Commit string
Runner string // "internal" | "<runner-name>"
}
RecordInput is the provenance written after a successful build.
type Remover ¶
Remover deletes a built image from the node it lives on. The service stays node-agnostic; callers supply the local engine client (docker.Client satisfies this). A nil Remover skips physical removal (DB-only).
type RetentionPolicy ¶
RetentionPolicy bounds the catalog: keep at least the newest KeepPerApp images per application, and only ever collect images older than MinAge. Protected images (live/pinned releases) are exempt regardless.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the image catalog: write provenance, list, and GC.
func NewService ¶
func NewService(images *repositories.ImageRepository, releases *repositories.ReleaseRepository) *Service
NewService wires the image catalog service.
func (*Service) ByDigests ¶ added in v1.6.8
ByDigests indexes the catalog rows for the given digests, so a page of registry tags can be enriched with build provenance in one query. Digests with no catalog row — images pushed by hand rather than built by a pipeline — are simply absent.
func (*Service) Delete ¶
Delete removes a catalog image (and its physical layer via remover) unless it is protected by a live or pinned release.
func (*Service) GC ¶
func (s *Service) GC(ctx context.Context, policy RetentionPolicy, remover Remover) (GCReport, error)
GC applies retention across all workspaces. It keeps the newest KeepPerApp images per app, never deletes an image referenced by a live or pinned release, and only collects images older than MinAge. remover may be nil (DB-only).
func (*Service) List ¶
List returns the workspace's catalog, optionally narrowed to one application.
func (*Service) ProtectedDigests ¶ added in v1.6.8
ProtectedDigests returns the content digests held by a live deployment or a pinned release — the images that must not be deleted. It is the same set GC exempts, exposed so other delete paths such as the registry's tag delete can refuse to remove an image something is still running.
func (*Service) Record ¶
func (s *Service) Record(in RecordInput) (*models.Image, error)
Record stores or updates the catalog entry for a freshly built image. The (workspace, digest) pair is unique, so re-recording the same digest updates provenance rather than duplicating — building the same content twice yields one row.