Documentation ¶
Overview ¶
Package image provides underlying data types for Singularity image formats. Additionally, all image types will satisfy the ImageFormat{} interface. This interface will expose all things necessary to use a Singularity image, whether through OCI or directly.
type ImageFormat interface { Root() *spec.Root - Root() returns the OCI compliant root of the Image. This function may preform some action, such as extracting the filesystem to a dir.
}
Index ¶
- Constants
- func CheckExt3Header(b []byte) (uint64, error)
- func CheckSquashfsHeader(b []byte) (uint64, error)
- func NewPartitionReader(image *Image, name string, index int) (io.Reader, error)
- func NewSectionReader(image *Image, name string, index int) (io.Reader, error)
- func ResolvePath(path string) (string, error)
- type Image
- type Section
Constants ¶
const ( // SQUASHFS constant for squashfs format SQUASHFS = iota + 1 // EXT3 constant for ext3 format EXT3 // SANDBOX constant for directory format SANDBOX // SIF constant for sif format SIF )
const ( // ErrNoSection corresponds to an image section not found ErrNoSection = readerError("no section found") // ErrNoPartition corresponds to an image partition not found ErrNoPartition = readerError("no partition found") )
const (
// RootFs partition name
RootFs = "rootfs"
)
Variables ¶
This section is empty.
Functions ¶
func CheckExt3Header ¶
CheckExt3Header checks if byte content contains a valid ext3 header and returns offset where ext3 partition begin
func CheckSquashfsHeader ¶
CheckSquashfsHeader checks if byte content contains a valid squashfs header and returns offset where squashfs partition start
func NewPartitionReader ¶
NewPartitionReader searches and returns a reader for an image partition identified by name or by index, if index is less than 0 only partition with provided name will be returned if a matching entry is found
func NewSectionReader ¶
NewSectionReader searches and returns a reader for an image section identified by name or by index, if index is less than 0 only section with provided name will be returned if a matching entry is found
func ResolvePath ¶
ResolvePath returns a resolved absolute path
Types ¶
type Image ¶
type Image struct { Path string `json:"path"` Name string `json:"name"` Type int `json:"type"` File *os.File `json:"-"` Fd uintptr `json:"fd"` Source string `json:"source"` Writable bool `json:"writable"` Partitions []Section `json:"partitions"` Sections []Section `json:"sections"` }
Image describes an image object, an image is composed of one or more partitions (eg: container root filesystem, overlay), image format like SIF contains descriptors pointing to chunk of data, chunks position and size are stored as image sections.
func (*Image) AuthorizedGroup ¶
AuthorizedGroup checks if image is owned by group supplied in groups list
func (*Image) AuthorizedOwner ¶
AuthorizedOwner checks if image is owned by user supplied in users list