manager

package
v2.77.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// could not be imported form build
	BaseImageSourceTypeCacheRepo = "cache-repo"
	BaseImageSourceTypeRepo      = "repo"
)

Variables

View Source
var ErrUnexpectedStagesStorageState = errors.New("unexpected stages storage state")

Functions

func ConvertStageDescForStagesStorage added in v2.14.0

func ConvertStageDescForStagesStorage(stageDesc *image.StageDesc, stagesStorage storage.StagesStorage) *image.StageDesc

func IsErrUnexpectedStagesStorageState

func IsErrUnexpectedStagesStorageState(err error) bool

func RetryOnUnexpectedStagesStorageState

func RetryOnUnexpectedStagesStorageState(ctx context.Context, _ StorageManagerInterface, f func() error) error

Types

type CopyStageIntoStorageOptions

type CopyStageIntoStorageOptions struct {
	FetchStage           stage.Interface
	ContainerBackend     container_backend.ContainerBackend
	ShouldBeBuiltMode    bool
	IsMultiplatformImage bool
	LogDetailedName      string
}

NOTE: FetchStage is a legacy option, which could in theory be removed. NOTE: FetchStage and ContainerBackend options used for a case of copying between local and remote storage. NOTE: Remote->Local copy does not need FetchStage and ContainerBackend options.

type CopyStageOptions

type CopyStageOptions struct {
	ContainerBackend     container_backend.ContainerBackend
	LegacyImage          container_backend.LegacyImageInterface
	FetchStage           stage.Interface
	IsMultiplatformImage bool
}

type FetchStageInfo added in v2.42.0

type FetchStageInfo struct {
	BaseImagePulled bool
	BaseImageSource string
}

type StagesList

type StagesList struct {
	Mux      sync.Mutex
	StageIDs []image.StageID
}

func NewStagesList

func NewStagesList(stageIDs []image.StageID) *StagesList

func (*StagesList) AddStageID

func (stages *StagesList) AddStageID(stageID image.StageID)

func (*StagesList) GetStageIDs

func (stages *StagesList) GetStageIDs() []image.StageID

type StorageManager

type StorageManager struct {
	ProjectName string

	StorageLockManager lock_manager.Interface

	StagesStorage              storage.PrimaryStagesStorage
	FinalStagesStorage         storage.StagesStorage
	CacheStagesStorageList     []storage.StagesStorage
	SecondaryStagesStorageList []storage.StagesStorage

	// These will be released automatically when current process exits
	SharedHostImagesLocks []lockgate.LockHandle

	FinalStagesListCacheMux sync.Mutex
	FinalStagesListCache    *StagesList
	// contains filtered or unexported fields
}

func NewStorageManager

func NewStorageManager(projectName string, stagesStorage storage.PrimaryStagesStorage, finalStagesStorage storage.StagesStorage, secondaryStagesStorageList, cacheStagesStorageList []storage.StagesStorage, storageLockManager lock_manager.Interface) *StorageManager

func (*StorageManager) CopyStage

func (m *StorageManager) CopyStage(ctx context.Context, src, dest storage.StagesStorage, stageID image.StageID, opts CopyStageOptions) (*image.StageDesc, error)

func (*StorageManager) CopyStageIntoCacheStorages

func (m *StorageManager) CopyStageIntoCacheStorages(ctx context.Context, stageID image.StageID, cacheStagesStorageList []storage.StagesStorage, opts CopyStageIntoStorageOptions) error

func (*StorageManager) CopyStageIntoFinalStorage

func (m *StorageManager) CopyStageIntoFinalStorage(ctx context.Context, stageID image.StageID, finalStagesStorage storage.StagesStorage, opts CopyStageIntoStorageOptions) (*image.StageDesc, error)

func (*StorageManager) CopySuitableStageDescByDigest added in v2.14.0

func (m *StorageManager) CopySuitableStageDescByDigest(ctx context.Context, stageDesc *image.StageDesc, sourceStagesStorage, destinationStagesStorage storage.StagesStorage, containerBackend container_backend.ContainerBackend, targetPlatform string) (*image.StageDesc, error)

func (*StorageManager) EnableParallel

func (m *StorageManager) EnableParallel(parallelTasksLimit int)

func (*StorageManager) FetchImportMetadata added in v2.69.0

func (m *StorageManager) FetchImportMetadata(ctx context.Context, projectName, id string) (*storage.ImportMetadata, error)

func (*StorageManager) FetchStage

func (*StorageManager) ForEachDeleteFinalStage

func (m *StorageManager) ForEachDeleteFinalStage(ctx context.Context, options ForEachDeleteStageOptions, stageDescSet image.StageDescSet, f func(ctx context.Context, stageDesc *image.StageDesc, err error) error) error

func (*StorageManager) ForEachDeleteStage

func (m *StorageManager) ForEachDeleteStage(ctx context.Context, options ForEachDeleteStageOptions, stageDescSet image.StageDescSet, f func(ctx context.Context, stageDesc *image.StageDesc, err error) error) error

func (*StorageManager) ForEachDeleteStageCustomTag

func (m *StorageManager) ForEachDeleteStageCustomTag(ctx context.Context, ids []string, f func(ctx context.Context, tag string, err error) error) error

func (*StorageManager) ForEachGetImportMetadata

func (m *StorageManager) ForEachGetImportMetadata(ctx context.Context, projectName string, ids []string, f func(ctx context.Context, metadataID string, metadata *storage.ImportMetadata, err error) error) error

func (*StorageManager) ForEachGetStageCustomTagMetadata

func (m *StorageManager) ForEachGetStageCustomTagMetadata(ctx context.Context, ids []string, f func(ctx context.Context, metadataID string, metadata *storage.CustomTagMetadata, err error) error) error

func (*StorageManager) ForEachRejectedStage added in v2.72.0

func (m *StorageManager) ForEachRejectedStage(ctx context.Context, stageIDs []image.StageID, f func(ctx context.Context, stageID image.StageID) error) error

func (*StorageManager) ForEachRmImageMetadata

func (m *StorageManager) ForEachRmImageMetadata(ctx context.Context, projectName, imageNameOrID string, stageIDCommitList map[string][]string, f func(ctx context.Context, commit, stageID string, err error) error) error

func (*StorageManager) ForEachRmImportMetadata

func (m *StorageManager) ForEachRmImportMetadata(ctx context.Context, projectName string, ids []string, f func(ctx context.Context, id string, err error) error) error

func (*StorageManager) ForEachRmManagedImage

func (m *StorageManager) ForEachRmManagedImage(ctx context.Context, projectName string, managedImages []string, f func(ctx context.Context, managedImage string, err error) error) error

func (*StorageManager) GenerateStageDescCreationTs added in v2.14.0

func (m *StorageManager) GenerateStageDescCreationTs(digest string, stageDescSet image.StageDescSet) (string, int64)

func (*StorageManager) GetCacheStagesStorageList

func (m *StorageManager) GetCacheStagesStorageList() []storage.StagesStorage

func (*StorageManager) GetFinalStageDescSet added in v2.14.0

func (m *StorageManager) GetFinalStageDescSet(ctx context.Context) (image.StageDescSet, error)

func (*StorageManager) GetFinalStagesStorage

func (m *StorageManager) GetFinalStagesStorage() storage.StagesStorage

func (*StorageManager) GetImageInfoGetter

func (m *StorageManager) GetImageInfoGetter(imageName string, stageDesc *image.StageDesc, opts image.InfoGetterOptions) *image.InfoGetter

func (*StorageManager) GetSecondaryStagesStorageList

func (m *StorageManager) GetSecondaryStagesStorageList() []storage.StagesStorage

func (*StorageManager) GetServiceValuesRepo

func (m *StorageManager) GetServiceValuesRepo() string

func (*StorageManager) GetStageDescSet added in v2.14.0

func (m *StorageManager) GetStageDescSet(ctx context.Context) (image.StageDescSet, error)

func (*StorageManager) GetStageDescSetByDigest added in v2.14.0

func (m *StorageManager) GetStageDescSetByDigest(ctx context.Context, stageName, stageDigest string, parentStageCreationTs int64) (image.StageDescSet, error)

func (*StorageManager) GetStageDescSetByDigestFromStagesStorage added in v2.14.0

func (m *StorageManager) GetStageDescSetByDigestFromStagesStorage(ctx context.Context, stageName, stageDigest string, parentStageCreationTs int64, stagesStorage storage.StagesStorage) (image.StageDescSet, error)

func (*StorageManager) GetStageDescSetByDigestFromStagesStorageWithCache added in v2.14.0

func (m *StorageManager) GetStageDescSetByDigestFromStagesStorageWithCache(ctx context.Context, stageName, stageDigest string, parentStageCreationTs int64, stagesStorage storage.StagesStorage) (image.StageDescSet, error)

func (*StorageManager) GetStageDescSetByDigestWithCache added in v2.14.0

func (m *StorageManager) GetStageDescSetByDigestWithCache(ctx context.Context, stageName, stageDigest string, parentStageCreationTs int64) (image.StageDescSet, error)

func (*StorageManager) GetStageDescSetWithCache added in v2.14.0

func (m *StorageManager) GetStageDescSetWithCache(ctx context.Context) (image.StageDescSet, error)

func (*StorageManager) GetStagesStorage

func (m *StorageManager) GetStagesStorage() storage.PrimaryStagesStorage

func (*StorageManager) InitCache

func (m *StorageManager) InitCache(ctx context.Context) error

func (*StorageManager) LockStageImage

func (m *StorageManager) LockStageImage(ctx context.Context, imageName string) error

func (*StorageManager) MaxNumberOfWorkers

func (m *StorageManager) MaxNumberOfWorkers() int

func (*StorageManager) SelectSuitableStageDesc added in v2.14.0

func (m *StorageManager) SelectSuitableStageDesc(ctx context.Context, c stage.Conveyor, stg stage.Interface, stageDescSet image.StageDescSet) (*image.StageDesc, error)

type StorageManagerInterface

type StorageManagerInterface interface {
	InitCache(ctx context.Context) error

	GetStagesStorage() storage.PrimaryStagesStorage
	GetFinalStagesStorage() storage.StagesStorage
	GetSecondaryStagesStorageList() []storage.StagesStorage
	GetCacheStagesStorageList() []storage.StagesStorage

	GetImageInfoGetter(imageName string, desc *image.StageDesc, opts image.InfoGetterOptions) *image.InfoGetter

	EnableParallel(parallelTasksLimit int)
	MaxNumberOfWorkers() int
	GenerateStageDescCreationTs(digest string, stageDescSet image.StageDescSet) (string, int64)

	LockStageImage(ctx context.Context, imageName string) error
	GetStageDescSetByDigest(ctx context.Context, stageName, stageDigest string, parentStageCreationTs int64) (image.StageDescSet, error)
	GetStageDescSetByDigestWithCache(ctx context.Context, stageName, stageDigest string, parentStageCreationTs int64) (image.StageDescSet, error)
	GetStageDescSetByDigestFromStagesStorage(ctx context.Context, stageName, stageDigest string, parentStageCreationTs int64, stagesStorage storage.StagesStorage) (image.StageDescSet, error)
	GetStageDescSetByDigestFromStagesStorageWithCache(ctx context.Context, stageName, stageDigest string, parentStageCreationTs int64, stagesStorage storage.StagesStorage) (image.StageDescSet, error)
	GetStageDescSet(ctx context.Context) (image.StageDescSet, error)
	GetStageDescSetWithCache(ctx context.Context) (image.StageDescSet, error)
	GetFinalStageDescSet(ctx context.Context) (image.StageDescSet, error)

	FetchStage(ctx context.Context, containerBackend container_backend.ContainerBackend, stg stage.Interface) (FetchStageInfo, error)
	FetchImportMetadata(ctx context.Context, projectName, id string) (*storage.ImportMetadata, error)
	SelectSuitableStageDesc(ctx context.Context, c stage.Conveyor, stg stage.Interface, stageDescSet image.StageDescSet) (*image.StageDesc, error)
	CopySuitableStageDescByDigest(ctx context.Context, stageDesc *image.StageDesc, sourceStagesStorage, destinationStagesStorage storage.StagesStorage, containerBackend container_backend.ContainerBackend, targetPlatform string) (*image.StageDesc, error)
	CopyStageIntoCacheStorages(ctx context.Context, stageID image.StageID, cacheStagesStorages []storage.StagesStorage, opts CopyStageIntoStorageOptions) error
	CopyStageIntoFinalStorage(ctx context.Context, stageID image.StageID, finalStagesStorage storage.StagesStorage, opts CopyStageIntoStorageOptions) (*image.StageDesc, error)

	ForEachDeleteStage(ctx context.Context, options ForEachDeleteStageOptions, stageDescSet image.StageDescSet, f func(ctx context.Context, stageDesc *image.StageDesc, err error) error) error
	ForEachDeleteFinalStage(ctx context.Context, options ForEachDeleteStageOptions, stageDescSet image.StageDescSet, f func(ctx context.Context, stageDesc *image.StageDesc, err error) error) error
	ForEachRejectedStage(ctx context.Context, stageIDs []image.StageID, f func(ctx context.Context, stageID image.StageID) error) error
	ForEachRmImageMetadata(ctx context.Context, projectName, imageNameOrID string, stageIDCommitList map[string][]string, f func(ctx context.Context, commit, stageID string, err error) error) error
	ForEachRmManagedImage(ctx context.Context, projectName string, managedImages []string, f func(ctx context.Context, managedImage string, err error) error) error
	ForEachGetImportMetadata(ctx context.Context, projectName string, ids []string, f func(ctx context.Context, metadataID string, metadata *storage.ImportMetadata, err error) error) error
	ForEachRmImportMetadata(ctx context.Context, projectName string, ids []string, f func(ctx context.Context, id string, err error) error) error
	ForEachGetStageCustomTagMetadata(ctx context.Context, ids []string, f func(ctx context.Context, metadataID string, metadata *storage.CustomTagMetadata, err error) error) error
	ForEachDeleteStageCustomTag(ctx context.Context, ids []string, f func(ctx context.Context, tag string, err error) error) error
}

type StorageOptions

type StorageOptions struct {
	ContainerBackend container_backend.ContainerBackend
	DockerRegistry   docker_registry.GenericApiInterface
}

Jump to

Keyboard shortcuts

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