Documentation ¶
Index ¶
- func AllFormatStrings() []string
- func Build(ctx context.Context, w io.WriteSeeker, args *BuildArgs) error
- func CreateBuilder(ctx context.Context, args *vimg.BuilderArgs) (*vimg.Builder, error)
- func DeregisterFilesystemCompiler(name string) error
- func FilesystemCompilers() []string
- func NegotiateSize(ctx context.Context, vimgBuilder *vimg.Builder, cfg *vcfg.VCFG, ...) error
- func NewFilesystemCompiler(name string, log elog.Logger, tree vio.FileTree, args interface{}) (vimg.FSCompiler, error)
- func RegisterFilesystemCompiler(name string, fn FSCompilerInstantiator) error
- func RegisterNewDiskFormat(format Format, extention string, alignment int64, mtu uint, ...) error
- type BuildArgs
- type BuildWriterInstantiator
- type FSCompilerInstantiator
- type Format
- func (x *Format) Alignment() int64
- func (x *Format) Build(ctx context.Context, log elog.View, w io.WriteSeeker, b *vimg.Builder, ...) error
- func (x *Format) DefaultMTU() uint
- func (x Format) MarshalJSON() ([]byte, error)
- func (x Format) MarshalText() (text []byte, err error)
- func (x Format) String() string
- func (x *Format) Suffix() string
- func (x *Format) UnmarshalJSON(data []byte) error
- func (x *Format) UnmarshalText(text []byte) error
- type KernelOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllFormatStrings ¶
func AllFormatStrings() []string
AllFormatStrings returns a list of all supported disk image formats.
func CreateBuilder ¶
CreateBuilder creates a vimg.Builder with args provided.
func DeregisterFilesystemCompiler ¶
DeregisterFilesystemCompiler deregisters a FSCompilerInstantiator for the given name.
func FilesystemCompilers ¶
func FilesystemCompilers() []string
FilesystemCompilers returns an alphabetised list of all registered file-system compilers. Note that a single compiler may appear multiple times in the list under different names.
func NegotiateSize ¶
func NegotiateSize(ctx context.Context, vimgBuilder *vimg.Builder, cfg *vcfg.VCFG, args *BuildArgs) error
NegotiateSize prebuilds the minimum amount for a disk.
func NewFilesystemCompiler ¶
func NewFilesystemCompiler(name string, log elog.Logger, tree vio.FileTree, args interface{}) (vimg.FSCompiler, error)
NewFilesystemCompiler returns a vimg.FSCompiler object that can be used to start a Vorteil image build, if the named file-system compiler has been registered.
func RegisterFilesystemCompiler ¶
func RegisterFilesystemCompiler(name string, fn FSCompilerInstantiator) error
RegisterFilesystemCompiler registers a FSCompilerInstantiator with a given name.
func RegisterNewDiskFormat ¶
func RegisterNewDiskFormat(format Format, extention string, alignment int64, mtu uint, builderFunc BuildWriterInstantiator) error
RegisterNewDiskFormat registers a new disk format that can be used with the vdisk package. Example: RegisterNewDiskFormat(Format("vmdk-custom"), ".vmdk", 0x200000, 1500, customVMDKBuilder)
Types ¶
type BuildArgs ¶
type BuildArgs struct { PackageReader vpkg.Reader Format Format SizeAlign int64 KernelOptions KernelOptions Logger elog.View WithVCFGDefaults bool }
BuildArgs contains all arguments a caller can use to customize the behaviour of the Build function.
type BuildWriterInstantiator ¶
type BuildWriterInstantiator func(io.WriteSeeker, *vimg.Builder, *vcfg.VCFG) (io.WriteSeeker, error)
BuildWriterInstantiator is a function that returns a new io.WriteSeeker that can be used to handle the writing of a raw image.
type FSCompilerInstantiator ¶
type FSCompilerInstantiator func(log elog.Logger, tree vio.FileTree, args interface{}) (vimg.FSCompiler, error)
FSCompilerInstantiator is a function that returns a new file-system compiler when provided with common arguments (any uncommon arguments can be passed through 'args').
type Format ¶
type Format string
Format is a string representing a supported disk image format.
const ( // RAWFormat is a disk type that returns "raw" RAWFormat Format = "raw" // VMDKFormat is a disk type that returns "vmdk" VMDKFormat Format = "vmdk" // VMDKSparseFormat is a disk type that returns "vmdk-sparse" VMDKSparseFormat Format = "vmdk-sparse" // VMDKStreamOptimizedFormat is a disk type that returns "vmdk-stream-optimized" VMDKStreamOptimizedFormat Format = "vmdk-stream-optimized" // GCPFArchiveFormat is a disk type that returns "gcp" GCPFArchiveFormat Format = "gcp" // XVAFormat is a disk type that returns "xva" XVAFormat Format = "xva" // VHDFormat is a disk type that returns "vhd" VHDFormat Format = "vhd" // VHDFixedFormat is a disk type that returns "vhd-fixed" VHDFixedFormat Format = "vhd-fixed" // VHDDynamicFormat is a disk type that returns "vhd-dynamic" VHDDynamicFormat Format = "vhd-dynamic" // QCOW2Format is a disk type that returns "qcow2" QCOW2Format Format = "qcow2" )
Supported disk image formats.
func ParseFormat ¶
ParseFormat resolves a string into a Format.
func (*Format) Alignment ¶
Alignment returns a size in bytes that a RAW image must be aligned to (an integer multiple of) to be compatible with the virtual disk image format.
func (*Format) Build ¶
func (x *Format) Build(ctx context.Context, log elog.View, w io.WriteSeeker, b *vimg.Builder, cfg *vcfg.VCFG) error
Build creates the disk for the correct format ...
func (*Format) DefaultMTU ¶
DefaultMTU returns the default MTU setting for the image format.
func (Format) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Format) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Format) Suffix ¶
Suffix returns an appropriate file extension for files containing the format.
func (*Format) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Format) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type KernelOptions ¶
KernelOptions contains all kernel configuration settings.