Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrWrongType = errors.New("wrong image type")
ErrWrongType is returned from [Opener].
Functions ¶
This section is empty.
Types ¶
type Extent ¶ added in v0.5.0
type Extent struct {
// Offset from start of the image in bytes.
Start int64 `json:"start"`
// Length of this extent in bytes.
Length int64 `json:"length"`
// Set if this extent is allocated.
Allocated bool `json:"allocated"`
// Set if this extent is read as zeros.
Zero bool `json:"zero"`
// Set if this extent is compressed.
Compressed bool `json:"compressed"`
}
Extent describes a byte range in the image with the same allocation, compression, or zero status. Extents are aligned to the underlying file system block size (e.g. 4k), or the image format cluster size (e.g. 64k). One extent can describe one or more file system blocks or image clusters.
type Image ¶
type Image interface {
io.ReaderAt
io.Closer
Extent(start, length int64) (Extent, error)
Type() Type
Size() int64 // -1 if unknown
Readable() error
}
Image implements io.ReaderAt and io.Closer.
type OpenWithType ¶
OpenWithType opens Image with the specified Type. Opener must return ErrWrongType when the image is not parsable with the specified Type.
type Snapshot ¶ added in v0.8.0
type Snapshot struct {
// ID is the unique ID of the snapshot.
ID string `json:"id"`
// Name is the human-readable name of the snapshot.
Name string `json:"name"`
// CreatedAt is the time at which the snapshot was taken.
// Nil if unknown.
CreatedAt *time.Time `json:"created_at,omitempty"`
}
Snapshot describes an internal snapshot stored in the image.
type SnapshotReader ¶ added in v0.8.0
type SnapshotReader interface {
// Snapshots returns the internal snapshots stored in the image.
Snapshots() ([]Snapshot, error)
}
SnapshotReader is optionally implemented by an Image that supports reading internal snapshots.