Documentation
¶
Overview ¶
Package image provides high-level access to Harbor / docker-save image archives: metadata scanning, merged filesystem views, directory listing without extraction, selective extraction of single entries, and full merged rootfs extraction.
Index ¶
- func ApplyImage(imageTarPath string, meta *types.ImageMetadata, outputDir string, ...) error
- func BuildFileSystem(imageTarPath string, meta *types.ImageMetadata) (*fsview.Node, error)
- func ExtractPath(imageTarPath string, meta *types.ImageMetadata, sourcePath, destPath string, ...) (int, error)
- func FormatListing(root *fsview.Node, target string) (string, error)
- func PrepareOutputDir(outputDir string, force bool) error
- func ScanImageMetadata(imageTarPath string, sel Selection) (*types.ImageMetadata, error)
- func WriteConfigYAML(outputDir string, meta *types.ImageMetadata) error
- type FileEntry
- type ProgressReporter
- type Selection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyImage ¶
func ApplyImage(imageTarPath string, meta *types.ImageMetadata, outputDir string, bufferSize int, progress ProgressReporter) error
func BuildFileSystem ¶
BuildFileSystem merges all layers of the image into an in-memory tree without writing anything to disk.
func ExtractPath ¶
func ExtractPath(imageTarPath string, meta *types.ImageMetadata, sourcePath, destPath string, bufferSize int) (int, error)
ExtractPath copies a single file or directory from the merged image filesystem to destPath, streaming only the entries that belong to the selection instead of extracting the whole image.
Semantics mirror cp: a directory source copied into an existing directory lands at destPath/<basename>, while a non-existent destination receives the copy directly. Extracting the image root ("/" or ".") puts its contents into destPath itself. Returns the number of entries written.
func FormatListing ¶
FormatListing renders the merged image filesystem at target the way `ls -al` would: one long-format line per entry, plus a total block line for directories. target "" or "/" lists the image root.
func PrepareOutputDir ¶
func ScanImageMetadata ¶
func ScanImageMetadata(imageTarPath string, sel Selection) (*types.ImageMetadata, error)
func WriteConfigYAML ¶
func WriteConfigYAML(outputDir string, meta *types.ImageMetadata) error
Types ¶
type FileEntry ¶
type FileEntry struct {
Name string `json:"name"`
Type string `json:"type"`
Mode string `json:"mode"`
Size int64 `json:"size"`
ModTime time.Time `json:"mod_time"`
Target string `json:"target,omitempty"`
}
FileEntry is a structured description of one entry in the merged image filesystem — the machine-friendly counterpart of a FormatListing line.
type ProgressReporter ¶
type ProgressReporter interface {
SetLayer(string)
AddLayer()
MarkDone()
}