comparator

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package comparator provides image comparison functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comparator

type Comparator struct {
	// contains filtered or unexported fields
}

Comparator compares two Docker images.

func NewComparator

func NewComparator(client docker.Client) *Comparator

NewComparator creates a new image comparator.

func (*Comparator) Compare

func (c *Comparator) Compare(ctx context.Context, image1Ref, image2Ref string) (*ComparisonResult, error)

Compare compares two Docker images.

type ComparisonResult

type ComparisonResult struct {
	Image1          models.Image   `json:"image1"`
	Image2          models.Image   `json:"image2"`
	SizeDiff        int64          `json:"size_diff"`
	SizeDiffPercent float64        `json:"size_diff_percent"`
	LayerDiffs      []LayerDiff    `json:"layer_diffs"`
	AddedLayers     []models.Layer `json:"added_layers"`
	RemovedLayers   []models.Layer `json:"removed_layers"`
	CommonLayers    int            `json:"common_layers"`
	MoreEfficient   string         `json:"more_efficient"`
	Recommendations []string       `json:"recommendations"`
}

ComparisonResult contains the comparison between two images.

type LayerDiff

type LayerDiff struct {
	Index    int    `json:"index"`
	Command1 string `json:"command1,omitempty"`
	Command2 string `json:"command2,omitempty"`
	Size1    int64  `json:"size1"`
	Size2    int64  `json:"size2"`
	SizeDiff int64  `json:"size_diff"`
	Type     string `json:"type"` // "modified", "added", "removed", "same"
}

LayerDiff represents a difference in a specific layer.

Jump to

Keyboard shortcuts

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