image

package
v0.0.0-...-c50090b Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(ctx context.Context, log *slog.Logger, sourceImage, destinationDevice string, compressed bool, progressInterval time.Duration) error

Write will pull an image and write it to local storage device with compress set to true it will use gzip compression to expand the data before writing to an underlying device.

Types

type Progress

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

func NewProgress

func NewProgress(w io.Writer, r io.Reader) *Progress

func (*Progress) Read

func (p *Progress) Read(b []byte) (n int, err error)

func (*Progress) Write

func (p *Progress) Write(b []byte) (n int, err error)

type WriteCounter

type WriteCounter struct {
	Total uint64
}

WriteCounter counts the number of bytes written to it. It implements to the io.Writer interface and we can pass this into io.TeeReader() which will report progress on each write cycle.

func (*WriteCounter) Write

func (wc *WriteCounter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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