servicemanager

package
v0.0.0-...-15f1d61 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 27 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")
)
View Source
var NewSpaceAllocator = spaceallocator.New

NewSpaceAllocator space allocator constructor.

View Source
var RemoveCachedServicesPeriod = 24 * time.Hour

RemoveCachedServicesPeriod global variable is used to be able to mocking the services TTL functionality in test.

Functions

This section is empty.

Types

type ImageParts

type ImageParts struct {
	ImageConfigPath   string
	ServiceConfigPath string
	ServiceFSPath     string
	LayersDigest      []string
}

ImageParts struct with paths for image parts.

type ServiceInfo

type ServiceInfo struct {
	aostypes.VersionInfo
	ServiceID       string
	ServiceProvider string
	ImagePath       string
	ManifestDigest  []byte
	Timestamp       time.Time
	Cached          bool
	Size            uint64
	GID             uint32
}

ServiceInfo service information.

type ServiceManager

type ServiceManager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

ServiceManager instance.

func New

func New(
	config *config.Config, serviceInfoProvider ServiceStorage,
) (sm *ServiceManager, err error)

New creates new service manager object.

func (*ServiceManager) Close

func (sm *ServiceManager) Close()

Close closes service manager instance.

func (*ServiceManager) GetImageParts

func (sm *ServiceManager) GetImageParts(service ServiceInfo) (parts ImageParts, err error)

GetImageParts gets image parts for the service.

func (*ServiceManager) GetServiceInfo

func (sm *ServiceManager) GetServiceInfo(serviceID string) (serviceInfo ServiceInfo, err error)

GetServiceInfo gets service information by id.

func (*ServiceManager) ProcessDesiredServices

func (sm *ServiceManager) ProcessDesiredServices(desiredServices []aostypes.ServiceInfo) error

ProcessDesiredServices installs, removes, restores desired services on the system.

func (*ServiceManager) ValidateService

func (sm *ServiceManager) ValidateService(service ServiceInfo) error

ValidateService validate service.

type ServiceStorage

type ServiceStorage interface {
	GetAllServiceVersions(serviceID string) ([]ServiceInfo, error)
	GetServices() ([]ServiceInfo, error)
	AddService(info ServiceInfo) error
	RemoveService(serviceID string, aosVersion uint64) error
	SetServiceCached(serviceID string, aosVersion uint64, cached bool) error
}

ServiceStorage provides API to create, remove or access services DB.

Jump to

Keyboard shortcuts

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