merger

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SourceLayerUnboundedIndex = -1
	WhiteoutPrefix            = ".wh."
)
View Source
const (
	MaxLandmark = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ByPriority

type ByPriority []*ConsolidatorEntry

func (ByPriority) Len

func (b ByPriority) Len() int

func (ByPriority) Less

func (b ByPriority) Less(i, j int) bool

func (ByPriority) Swap

func (b ByPriority) Swap(i, j int)

type Consolidator

type Consolidator struct {
	Deltas []*Delta `json:"delta,omitempty"`

	// Source starts from index 0
	Source []*common.TraceableBlobDigest `json:"source,omitempty"`

	Offsets []int64 `json:"offsets"`
	// contains filtered or unexported fields
}

func NewConsolidator

func NewConsolidator(ctx context.Context) *Consolidator

func (*Consolidator) AddDelta

func (c *Consolidator) AddDelta(delta *Delta) error

AddDelta image to the pool of images, All the

func (*Consolidator) ExportTOC

func (c *Consolidator) ExportTOC(w io.Writer, beautified bool) error

func (*Consolidator) GetOutputQueue

func (c *Consolidator) GetOutputQueue() *[]*OutputEntry

func (*Consolidator) PopulateOffset

func (c *Consolidator) PopulateOffset() error

type ConsolidatorEntry

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

type Delta

type Delta struct {

	// DigestList references to actual layer storage
	DigestList []*common.TraceableBlobDigest `json:"d,omitempty"`

	// Pool stores the list of pointer to all the TOC entries
	Pool [][]*common.TraceableEntry `json:"p,omitempty"`

	// file queue
	CheckPoint []int64

	ImageName string `json:"in,omitempty"`
	ImageTag  string `json:"it,omitempty"`

	Config string `json:"config"`
	// contains filtered or unexported fields
}

func GetDelta

func GetDelta(ctx context.Context, a, b *Overlay) (d *Delta)

GetDelta moves from a to b. b is the targeted image

func (*Delta) ExportTOC

func (d *Delta) ExportTOC(w io.Writer, beautify bool) error

ExportTOC writes TOC for this image It must runs after the delta image has been consolidated (so that we have the correct offset point to the gzip chunks)

func (*Delta) OutputHeader

func (d *Delta) OutputHeader(w io.Writer) (headerSize int64, err error)

OutputHeader writes compressed header for this delta image and returns the header size It must runs after the delta image has been consolidated (so that we have the correct offset point to the gzip chunks)

func (*Delta) PopulateOffset

func (d *Delta) PopulateOffset() error

type OutputEntry

type OutputEntry struct {
	Source       int   // maps to Consolidator.source
	SourceOffset int64 // offset in the source layer

	Offset         int64
	CompressedSize int64
	// contains filtered or unexported fields
}

type Overlay

type Overlay struct {

	// root is the root of the file system
	Root *common.TraceableEntry `json:"-"`

	// pool stores the list of pointer to all the TOC entries
	EntryMap map[string]*common.TraceableEntry `json:"p,omitempty"`

	// digest list (reference to actual layer storage)
	// DigestList index range [0, n) where n is the total number of layers
	// proxy.TraceableEntry's "source" int is starting from 1 which needs to subtract one to
	// get the correct index
	DigestList []*common.TraceableBlobDigest `json:"d,omitempty"`

	ImageName string `json:"-"`
	ImageTag  string `json:"-"`

	Config []byte `json:"-"`
	// contains filtered or unexported fields
}

func LoadMergedImage

func LoadMergedImage(ctx context.Context, db *bolt.DB, imageName, imageTag string) (*Overlay, error)

func NewOverlayBuilder

func NewOverlayBuilder(ctx context.Context, db *bolt.DB) (ov *Overlay)

func (*Overlay) AddImage

func (ov *Overlay) AddImage(imageName, imageTag string) error

AddImage overlays an entire image on top of what exists in the Overlay object.

func (*Overlay) AddLayer

func (ov *Overlay) AddLayer(tb *common.TraceableBlobDigest) error

AddLayer overlays a single layer on top of what exists in the Overlay object.

func (*Overlay) ExportTOC

func (ov *Overlay) ExportTOC(w io.Writer) error

ExportTOC writes the TOC in json to a writer

func (*Overlay) SaveMergedImage

func (ov *Overlay) SaveMergedImage() error

Jump to

Keyboard shortcuts

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