image

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewIncusImage

func NewIncusImage(repo ImageIncusRepo, filesRepo ImageIncusFileRepo, simplestreams SimplestreamsPort) *imageIncusService

func NewIncusSource

func NewIncusSource(repo IncusImageSourceRepo, incusImageSource IncusImageSourcePort) *incusSourceService

func ValidateIncusImageArchitecture

func ValidateIncusImageArchitecture(architecture string) error

func ValidateIncusImageName

func ValidateIncusImageName(name string) error

func ValidateIncusImageVersion

func ValidateIncusImageVersion(version string) error

ValidateIncusImageVersion checks the version matches the expected version format in simplestreams. https://github.com/lxc/incus/blob/1d64af1e40ced8716280bd4fcf044dce4ca6d5cf/shared/simplestreams/products.go#L87-L95

Types

type CancelFunc

type CancelFunc func() error

type CommitFunc

type CommitFunc func() error

type ExprIncusImageVersionFile

type ExprIncusImageVersionFile struct {
	Name            string `json:"name"              yaml:"name"              expr:"name"`
	OperatingSystem string `json:"operating_system"  yaml:"operating_system"  expr:"operating_system"`
	Release         string `json:"release"           yaml:"release"           expr:"release"`
	Architecture    string `json:"architecture"      yaml:"architecture"      expr:"architecture"`
	Variant         string `json:"variant"           yaml:"variant"           expr:"variant"`
	Version         string `json:"version"           yaml:"version"           expr:"version"`
	Filename        string `json:"filename"          yaml:"filename"          expr:"filename"`
	FileType        string `json:"file_type"         yaml:"file_type"         expr:"file_type"`
	Size            int64  `json:"size"              yaml:"size"              expr:"size"`
}

type ImageIncusFileRepo

type ImageIncusFileRepo interface {
	Exists(ctx context.Context, img *IncusImage, versionIdentifier string, filename string) (bool, error)
	Get(ctx context.Context, img *IncusImage, versionIdentifier string, filename string) (_ io.ReadCloser, size int64, _ error)
	Put(ctx context.Context, img *IncusImage, versionIdentifier string, filename string, content io.ReadCloser) (_ CommitFunc, _ CancelFunc, size int64, _ error)
	Delete(ctx context.Context, img *IncusImage) error
	DeleteVersion(ctx context.Context, img *IncusImage, versionIdentifier string) error
	DeleteVersionFile(ctx context.Context, img *IncusImage, versionIdentifier string, filename string) error
	UsageInformation(ctx context.Context) (UsageInformation, error)
}

type ImageIncusRepo

type ImageIncusRepo interface {
	Create(ctx context.Context, newIncusImage IncusImage) (int64, error)
	GetAll(ctx context.Context) (IncusImages, error)
	GetAllWithFilter(ctx context.Context, filter IncusImageFilter) (IncusImages, error)
	GetAllNames(ctx context.Context) ([]string, error)
	ExistsByName(ctx context.Context, name string) (bool, error)
	GetByName(ctx context.Context, name string) (*IncusImage, error)
	Update(ctx context.Context, incusImage IncusImage) error
	Upsert(ctx context.Context, incusImage IncusImage) error
	DeleteByName(ctx context.Context, name string) error
}

type ImageIncusService

type ImageIncusService interface {
	AddVersion(ctx context.Context, mr *multipart.Reader) (name string, _ error)
	GetAll(ctx context.Context) (IncusImages, error)
	GetAllNames(ctx context.Context) ([]string, error)
	GetByName(ctx context.Context, name string) (*IncusImage, error)
	DeleteByName(ctx context.Context, name string) error
	DeleteVersionByName(ctx context.Context, name string, version string) error
	DeleteBySource(ctx context.Context, sourceName string) error
	GetVersionFileByName(ctx context.Context, name string, version string, filename string) (_ io.ReadCloser, size int64, _ error)
	Update(ctx context.Context, incusImage IncusImage) error
	ValidateFilterExpression(ctx context.Context, filterExpression string) error
	RefreshFromSource(ctx context.Context, source IncusImageSource) error
}

type IncusImage

type IncusImage struct {
	ID          int64    `json:"-"`
	Name        string   `json:"name" db:"primary=yes"`
	Aliases     []string `json:"aliases" db:"marshal=json"`
	Description string   `json:"description"`

	OperatingSystem string `json:"os"`
	Release         string `json:"release"`
	Architecture    string `json:"arch"`
	Variant         string `json:"variant"`

	Versions api.IncusImageVersions `json:"versions"`

	Source *string `json:"source" db:"leftjoin=incus_image_sources.name"`

	LastUpdated time.Time `json:"-" expr:"last_updated" db:"update_timestamp"`
}

func (IncusImage) FilePath

func (i IncusImage) FilePath() string

func (IncusImage) Path

func (i IncusImage) Path() string

func (IncusImage) Validate

func (i IncusImage) Validate() error

type IncusImageFilter

type IncusImageFilter struct {
	ID              *int
	Name            *string
	OperatingSystem *string
	Release         *string
	Architecture    *string
	Variant         *string
	Source          *string
}

type IncusImageSource

type IncusImageSource struct {
	ID               int64  `json:"-"`
	Name             string `json:"name" db:"primary=yes"`
	URL              string `json:"url"`
	FilterExpression string `json:"filter_expression"`

	LastUpdated time.Time `json:"-" expr:"last_updated" db:"update_timestamp"`
}

func (IncusImageSource) Validate

func (s IncusImageSource) Validate(ctx context.Context, incusImageSource IncusImageSourcePort) error

type IncusImageSourceFilter

type IncusImageSourceFilter struct {
	ID   *int
	Name *string
}

type IncusImageSourcePort

type IncusImageSourcePort interface {
	ValidateFilterExpression(ctx context.Context, filterExpression string) error
	RefreshFromSource(ctx context.Context, source IncusImageSource) error
	DeleteBySource(ctx context.Context, sourceName string) error
}

type IncusImageSourceRepo

type IncusImageSourceRepo interface {
	Create(ctx context.Context, source IncusImageSource) (int64, error)
	GetAll(ctx context.Context) (IncusImageSources, error)
	GetAllNames(ctx context.Context) ([]string, error)
	GetByName(ctx context.Context, name string) (*IncusImageSource, error)
	Update(ctx context.Context, source IncusImageSource) error
	DeleteByName(ctx context.Context, name string) error
}

type IncusImageSourceService

type IncusImageSourceService interface {
	Create(ctx context.Context, source IncusImageSource) (IncusImageSource, error)
	GetAll(ctx context.Context) (IncusImageSources, error)
	GetAllNames(ctx context.Context) ([]string, error)
	GetByName(ctx context.Context, name string) (*IncusImageSource, error)
	Update(ctx context.Context, source IncusImageSource) error
	DeleteByName(ctx context.Context, name string) error
	RefreshAll(ctx context.Context) error
	RefreshByName(ctx context.Context, name string) error
}

type IncusImageSources

type IncusImageSources []IncusImageSource

type IncusImages

type IncusImages []IncusImage

type SimplestreamsPort

type SimplestreamsPort interface {
	GetImageList(ctx context.Context, source IncusImageSource) (IncusImages, error)
	GetFile(ctx context.Context, source IncusImageSource, path string) (io.ReadCloser, error)
}

type UsageInformation

type UsageInformation struct {
	TotalSpaceBytes     uint64
	AvailableSpaceBytes uint64
	UsedSpaceBytes      uint64
}

Directories

Path Synopsis
adapter
repo

Jump to

Keyboard shortcuts

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