imagemanager

package
v0.0.0-...-8f7bd20 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotExist not exist service error.
	ErrNotExist = errors.New("service not exist")

	// ErrVersionMismatch new service version <= existing one.
	ErrVersionMismatch = errors.New("version mismatch")

	// NewSpaceAllocator space allocator constructor.
	//nolint:gochecknoglobals // used for unit test mock
	NewSpaceAllocator = spaceallocator.New
)

Functions

This section is empty.

Types

type Decrypter

type Decrypter interface {
	DecryptAndValidate(encryptedFile, decryptedFile string, params fcrypt.DecryptParams) error
}

Decrypter interface to decrypt and validate image.

type Imagemanager

type Imagemanager struct {
	// contains filtered or unexported fields
}

Imagemanager image manager instance.

func New

func New(
	cfg *config.Config, storage Storage, decrypter Decrypter,
) (imagemanager *Imagemanager, err error)

**********************************************************************************************************************

  • Public *********************************************************************************************************************

New creates new image manager object.

func (*Imagemanager) Close

func (imagemanager *Imagemanager) Close()

Close close image manager object.

func (*Imagemanager) GetLayerInfo

func (imagemanager *Imagemanager) GetLayerInfo(digest string) (LayerInfo, error)

GetLayerInfo gets layer information by id.

func (*Imagemanager) GetLayersStatus

func (imagemanager *Imagemanager) GetLayersStatus() ([]unitstatushandler.LayerStatus, error)

GetLayersStatus gets all layers status.

func (*Imagemanager) GetRemoveServiceChannel

func (imagemanager *Imagemanager) GetRemoveServiceChannel() (channel <-chan string)

func (*Imagemanager) GetServiceInfo

func (imagemanager *Imagemanager) GetServiceInfo(serviceID string) (ServiceInfo, error)

GetServiceInfo gets service information by id.

func (*Imagemanager) GetServicesStatus

func (imagemanager *Imagemanager) GetServicesStatus() ([]unitstatushandler.ServiceStatus, error)

GetServicesStatus gets all services status.

func (*Imagemanager) InstallLayer

func (imagemanager *Imagemanager) InstallLayer(layerInfo cloudprotocol.LayerInfo,
	chains []cloudprotocol.CertificateChain, certs []cloudprotocol.Certificate,
) error

InstallLayer installs layer to the image store dir.

func (*Imagemanager) InstallService

func (imagemanager *Imagemanager) InstallService(serviceInfo cloudprotocol.ServiceInfo,
	chains []cloudprotocol.CertificateChain, certs []cloudprotocol.Certificate,
) error

InstallService installs service to the image store dir.

func (*Imagemanager) RemoveLayer

func (imagemanager *Imagemanager) RemoveLayer(digest string) error

RemoveLayer makes layer cached.

func (*Imagemanager) RemoveService

func (imagemanager *Imagemanager) RemoveService(serviceID string) error

RemoveService makes service cached.

func (*Imagemanager) RestoreLayer

func (imagemanager *Imagemanager) RestoreLayer(digest string) error

RestoreLayer restores layer from a cache.

func (*Imagemanager) RestoreService

func (imagemanager *Imagemanager) RestoreService(serviceID string) error

RestoreService restores service from a cache.

func (*Imagemanager) RevertService

func (imagemanager *Imagemanager) RevertService(serviceID string) error

RevertService reverts already stored service.

type LayerInfo

type LayerInfo struct {
	aostypes.LayerInfo
	RemoteURL string
	Path      string
	Timestamp time.Time
	Cached    bool
}

LayerInfo service information.

type ServiceInfo

type ServiceInfo struct {
	aostypes.ServiceInfo
	RemoteURL    string
	Path         string
	Timestamp    time.Time
	Cached       bool
	Config       aostypes.ServiceConfig
	Layers       []string
	ExposedPorts []string
}

ServiceInfo service information.

type Storage

type Storage interface {
	GetServiceVersions(serviceID string) ([]ServiceInfo, error)
	GetServicesInfo() ([]ServiceInfo, error)
	GetLayersInfo() ([]LayerInfo, error)
	GetServiceInfo(serviceID string) (ServiceInfo, error)
	GetLayerInfo(digest string) (LayerInfo, error)
	AddLayer(layer LayerInfo) error
	AddService(service ServiceInfo) error
	SetLayerCached(digest string, cached bool) error
	SetServiceCached(serviceID string, cached bool) error
	RemoveService(serviceID string, version string) error
	RemoveLayer(digest string) error
}

Storage provides API to create, remove or access information from DB.

Jump to

Keyboard shortcuts

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