convert

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 5 Imported by: 6

Documentation

Index

Constants

View Source
const BufferSize = 1024 * 1024
View Source
const SegmentSize = 32 * BufferSize

Smaller value may increase the overhead of synchornizing multiple works. Larger value may be less efficient for smaller images. The default value gives good results for the lima default Ubuntu image.

View Source
const Workers = 8

For best I/O throughput we want to have enough in-flight requests, regardless of number of cores. For best decompression we want to use one worker per core, but too many workers is less effective. The default value gives good results with lima default Ubuntu image.

Variables

This section is empty.

Functions

This section is empty.

Types

type Converter

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

func New

func New(opts Options) (*Converter, error)

New returns a new converter initialized from options.

func (*Converter) Convert

func (c *Converter) Convert(wa io.WriterAt, ra io.ReaderAt, size int64) error

Convert copy size bytes from io.ReaderAt to io.WriterAt. Unallocated areas or areas full of zeros in the source are keep unallocated in the destination. The destination must be new empty or full of zeroes.

type Options

type Options struct {
	// SegmentSize in bytes. Must be aligned to BufferSize. If not set, use the
	// default value (32 MiB).
	SegmentSize int64

	// BufferSize in bytes. If not set, use the default value (1 MiB).
	BufferSize int

	// Workers is the number of goroutines copying buffers in parallel. If not set
	// use the default value (8).
	Workers int
}

func (*Options) Validate

func (o *Options) Validate() error

Validate validates options and set default values. Returns an error for invalid option values.

Jump to

Keyboard shortcuts

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