Documentation
¶
Overview ¶
Package extract walks the files of a single image layer without writing them to disk. It records whiteouts so that callers can tell which files are still visible in the final image filesystem and which were deleted by a later layer but are still shipped with the image.
Index ¶
Constants ¶
const ( SigMaxFileSize = "meles.Limits.MaxFileSize" SigUnsupported = "meles.Unsupported.TarEntry" SigEngineTooBig = "meles.Limits.StreamMaxLength" )
Signatures of skipped files, in the style of the engine's Heuristics.Limits.Exceeded.* results, so that ignore rules can name them.
Variables ¶
var ErrLimitExceeded = errors.New("limit exceeded")
ErrLimitExceeded is returned (wrapped) when a layer exceeds a hard limit. A layer that exceeds a hard limit is never reported as clean.
Functions ¶
Types ¶
type File ¶
File is a regular file of a layer. Content is only valid during the callback passed to Walk.
type Layer ¶
type Layer struct {
// Entries holds all non-directory entries by absolute path.
Entries map[string]bool
// Whiteouts holds paths deleted by a .wh.<name> entry.
Whiteouts map[string]bool
// Opaques holds directories whose lower-layer content is hidden by a
// .wh..wh..opq entry.
Opaques map[string]bool
Skipped []Skipped
// Files is the number of regular files passed to the callback.
Files int
// Bytes is the number of uncompressed bytes read.
Bytes int64
}
Layer is everything Walk learned about a layer apart from file contents.
type Limits ¶
type Limits struct {
// MaxFileSize skips (and reports) regular files larger than this.
// 0 means no limit.
MaxFileSize int64
// MaxLayerSize is a hard limit on the uncompressed size of a layer.
// 0 means no limit.
MaxLayerSize int64
// MaxFiles is a hard limit on the number of entries in a layer.
// 0 means no limit.
MaxFiles int
}
Limits protect against tar bombs and oversized files.
type Skipped ¶
type Skipped struct {
Path string `json:"path"`
Size int64 `json:"size"`
Reason string `json:"reason"`
// Signature names the reason: SigMaxFileSize, SigUnsupported,
// SigEngineTooBig or the engine's Heuristics.Limits.Exceeded.*.
Signature string `json:"signature"`
// SHA256 of the file content, hex.
SHA256 string `json:"sha256,omitempty"`
}
Skipped is a file that was not scanned.