layermanager

package
v0.0.0-...-03d9887 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: 16 Imported by: 0

Documentation

Overview

Package layermanager provides set of API to controls service fs layers

Index

Constants

This section is empty.

Variables

View Source
var ErrNotExist = errors.New("layer does not exist")
View Source
var NewSpaceAllocator = spaceallocator.New

NewSpaceAllocator space allocator constructor.

View Source
var RemoveCachedLayersPeriod = 24 * time.Hour

RemoveCachedLayersPeriod global variable is used to be able to mocking the layers TTL functionality in test.

Functions

This section is empty.

Types

type LayerInfo

type LayerInfo struct {
	Digest    string
	LayerID   string
	Version   string
	Path      string
	OSVersion string
	Timestamp time.Time
	Cached    bool
	Size      uint64
}

LayerInfo layer information.

type LayerManager

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

LayerManager instance.

func New

func New(config *config.Config, layerStorage LayerStorage) (layermanager *LayerManager, err error)

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

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

New creates new layer manager instance.

func (*LayerManager) Close

func (layermanager *LayerManager) Close()

Close closes layer manager instance.

func (*LayerManager) GetLayerInfoByDigest

func (layermanager *LayerManager) GetLayerInfoByDigest(digest string) (layer LayerInfo, err error)

GetLayerInfoByDigest gets layers information by layer digest.

func (*LayerManager) ProcessDesiredLayers

func (layermanager *LayerManager) ProcessDesiredLayers(desiredLayers []aostypes.LayerInfo) error

ProcessDesiredLayers installs, removes, restores desired layers on the system.

type LayerStorage

type LayerStorage interface {
	AddLayer(layer LayerInfo) error
	DeleteLayerByDigest(digest string) error
	GetLayersInfo() ([]LayerInfo, error)
	GetLayerInfoByDigest(digest string) (LayerInfo, error)
	SetLayerCached(digest string, cached bool) error
}

LayerStorage provides API to add, remove or access layer information.

type SpaceAllocator

type SpaceAllocator interface {
	AllocateLayersSpace(extraSpace int64) (allocatedLayersSize int64, err error)
}

SpaceAllocator space allocator.

Jump to

Keyboard shortcuts

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