progress

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2018 License: Apache-2.0 Imports: 1 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageFetch

type ImageFetch struct {
	ContainerID string
	Image       string
	Resolved    bool
	Failed      bool
	// contains filtered or unexported fields
}

ImageFetch stores container pull status

func CreateImageFetch

func CreateImageFetch(containerID, image string, resolved bool, layers map[string]*Status) *ImageFetch

CreateImageFetch creates new ImageFetch for given name

func NewImageFetch

func NewImageFetch(containerID, image string) *ImageFetch

NewImageFetch creates new ImageFetch for given name

func (*ImageFetch) Add

func (s *ImageFetch) Add(ref, digest string)

Add new layer ref to the progress list

func (*ImageFetch) AllDone

func (s *ImageFetch) AllDone()

AllDone marks all layers downloaded

func (*ImageFetch) GetLayers

func (s *ImageFetch) GetLayers() (result []Status)

GetLayers return list of layers

func (*ImageFetch) GetProgress

func (s *ImageFetch) GetProgress() (current, total int64)

GetProgress calculates current and total bytes of all layers

func (*ImageFetch) IsDone

func (s *ImageFetch) IsDone() bool

IsDone return true if all bytes of all layers are downloaded

func (*ImageFetch) SetToDone

func (s *ImageFetch) SetToDone(ref string)

SetToDone updates layer ref to the done state

func (*ImageFetch) SetToDownloading

func (s *ImageFetch) SetToDownloading(ref string, offset, total int64)

SetToDownloading updates layer ref to the waiting state

func (*ImageFetch) SetToFailed

func (s *ImageFetch) SetToFailed()

SetToFailed marks fetch to be failed

func (*ImageFetch) SetToWaiting

func (s *ImageFetch) SetToWaiting(ref string)

SetToWaiting updates layer ref to the waiting state

type Status

type Status struct {
	Ref    string
	Digest string
	Status string
	Offset int64
	Total  int64
}

Status represents single layer ref current progress

func NewStatus

func NewStatus(ref, digest string) *Status

NewStatus creates new status in waiting state

func (*Status) Done

func (s *Status) Done()

Done marks Status to done state

func (*Status) Downloading

func (s *Status) Downloading(offset, total int64)

Downloading updates Status to downloading

func (*Status) Waiting

func (s *Status) Waiting()

Waiting marks status to be in waiting state

Jump to

Keyboard shortcuts

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