Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
lima-vm
GitHub Repository: lima-vm/lima
Path: blob/master/pkg/imgutil/manager.go
2601 views
1
// SPDX-FileCopyrightText: Copyright The Lima Authors
2
// SPDX-License-Identifier: Apache-2.0
3
4
package imgutil
5
6
import (
7
"context"
8
"os"
9
10
"github.com/lima-vm/go-qcow2reader/image"
11
)
12
13
// ImageDiskManager defines the common operations for disk image utilities.
14
type ImageDiskManager interface {
15
// CreateDisk creates a new disk image with the specified size.
16
CreateDisk(ctx context.Context, disk string, size int64) error
17
18
// ResizeDisk resizes an existing disk image to the specified size.
19
ResizeDisk(ctx context.Context, disk string, size int64) error
20
21
// Convert converts a disk image to the specified format.
22
Convert(ctx context.Context, imageType image.Type, source, dest string, size *int64, allowSourceWithBackingFile bool) error
23
24
// MakeSparse makes a file sparse, starting from the specified offset.
25
MakeSparse(ctx context.Context, f *os.File, offset int64) error
26
}
27
28