image

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImgJson

type ImgJson struct {
	Created      interface{} `json:"created"`
	Author       interface{} `json:"author"`
	Architecture interface{} `json:"architecture"`
	Os           interface{} `json:"os"`
	Config       interface{} `json:"config"`
	Rootfs       struct {
		DiffIds []string `json:"diff_ids"` // from bottom to top
		Type    string   `json:"type"`
	} `json:"rootfs"`
	History interface{} `json:"history"`
}

An ImgJson represents the json file of a docker image in a tar file. See: https://github.com/moby/moby/blob/master/image/spec/v1.2.md

type ImgTarFs

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

func ParseImgTarFs

func ParseImgTarFs(path string) ImgTarFs

ParseImgTarFs parses the filesystem of a docker image in a tar file.

func (*ImgTarFs) DumpImgJson

func (f *ImgTarFs) DumpImgJson()

func (*ImgTarFs) DumpManifest

func (f *ImgTarFs) DumpManifest()

func (*ImgTarFs) GetImageJson

func (f *ImgTarFs) GetImageJson() ImgJson

func (*ImgTarFs) GetLayers

func (f *ImgTarFs) GetLayers() []ImgTarLayer

func (*ImgTarFs) GetManifest

func (f *ImgTarFs) GetManifest() []Manifest

func (*ImgTarFs) TarWholeFs

func (f *ImgTarFs) TarWholeFs(dst string)

TarWholeFs archives the whole filesystem of the image to a tar file.

type ImgTarLayer

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

An ImgTarLayer represents a layer of a docker image in a tar file.

func (*ImgTarLayer) GetLayerTarPath

func (l *ImgTarLayer) GetLayerTarPath() string

GetLayerTarPath returns the path of the layer tar file.

func (*ImgTarLayer) LayerTarSha256Sum

func (l *ImgTarLayer) LayerTarSha256Sum() string

LayerTarSha256Sum returns the sha256 sum of the layer tar file.

func (*ImgTarLayer) RmLayerTar

func (l *ImgTarLayer) RmLayerTar()

type LayerInfo

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

func NewLayerInfo

func NewLayerInfo(layerPath string) *LayerInfo

NewLayerInfo creates a new LayerInfo from a layer path, with some very basic fields

func (*LayerInfo) GetDiffPath

func (l *LayerInfo) GetDiffPath() string

func (*LayerInfo) GetLayerPath

func (l *LayerInfo) GetLayerPath() string

func (*LayerInfo) GetLayerSize

func (l *LayerInfo) GetLayerSize() int64

func (*LayerInfo) GetlinkContent

func (l *LayerInfo) GetlinkContent() string

func (*LayerInfo) SetCacheId

func (l *LayerInfo) SetCacheId(cacheId string)

func (*LayerInfo) SetCacheIdPath

func (l *LayerInfo) SetCacheIdPath(cacheidPath string)

func (*LayerInfo) SetMetaPath

func (l *LayerInfo) SetMetaPath(metaPath string)

func (*LayerInfo) SetSizePath

func (l *LayerInfo) SetSizePath(sizePath string)

Set size path, this will also set the size field

type Manifest

type Manifest struct {
	Config   string   `json:"Config"`
	RepoTags []string `json:"RepoTags"`
	Layers   []string `json:"Layers"` // 0->n : bottom->top
}

type OriginalLayer

type OriginalLayer struct {
	LayerInfo
}

An OriginalLayer represents an original overlay layer of a docker image.

func NewOriginalLayer

func NewOriginalLayer(layerInfo LayerInfo) OriginalLayer

NewOriginalLayer creates a new OriginalLayer from a LayerInfo

func (*OriginalLayer) Shadow

func (l *OriginalLayer) Shadow() ShadowLayer

Shadow creates a ShadowLayer from an original layer in memory, not create it in the filesystem. It is the counterpart of ShadowLayer.Original.

type ShadowLayer

type ShadowLayer struct {
	LayerInfo
	// contains filtered or unexported fields
}

A ShadowLayer represents a shadowed overlay layer of a docker image. Each original layer will have a corresponding shadow layer. Files used in an original layer will be copied to the shadow layer.

func NewShadowLayer

func NewShadowLayer(layerInfo LayerInfo) ShadowLayer

NewShadowLayer creates a new ShadowLayer from a LayerInfo

func (*ShadowLayer) Dump

func (l *ShadowLayer) Dump()

Dump creates the shadow layer in the filesystem. It is the counterpart of Restore.

func (*ShadowLayer) DumpLayerSize

func (l *ShadowLayer) DumpLayerSize(size string)

DumpLayerSize writes the size of the layer to the size file. It modifies the filesystem.

func (*ShadowLayer) GetLayerSize

func (l *ShadowLayer) GetLayerSize() int64

func (*ShadowLayer) GetRealPath

func (l *ShadowLayer) GetRealPath() string

func (*ShadowLayer) Original

func (l *ShadowLayer) Original() OriginalLayer

Original returns the original layer from a shadow layer in memory, not create it in the filesystem It is the counterpart of OriginalLayer.Shadow.

func (*ShadowLayer) Restore

func (l *ShadowLayer) Restore()

Restore restores the filesystem of the docker image to the state before shadowing. It modifies the filesystem. It is the counterpart of Dump.

func (*ShadowLayer) SetCacheId

func (l *ShadowLayer) SetCacheId(cacheId string)

func (*ShadowLayer) SetLayerSize

func (l *ShadowLayer) SetLayerSize(size string)

func (*ShadowLayer) SetLowers

func (l *ShadowLayer) SetLowers(newLowers string)

SetLowers replaces existing lowers to new lowers

func (*ShadowLayer) TarDiff

func (l *ShadowLayer) TarDiff(destFile string)

TarDiff archives the diff directory of the shadow layer to a tar file.

Jump to

Keyboard shortcuts

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