manager

package
v1.2.285 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpectedStagesStorageState = errors.New("unexpected stages storage state")
	ErrStageNotFound                = errors.New("stage not found")
)

Functions

func ConvertStageDescriptionForStagesStorage added in v1.2.114

func ConvertStageDescriptionForStagesStorage(stageDesc *image.StageDescription, stagesStorage storage.StagesStorage) *image.StageDescription

func IsErrStageNotFound added in v1.2.77

func IsErrStageNotFound(err error) bool

func IsErrUnexpectedStagesStorageState added in v1.2.77

func IsErrUnexpectedStagesStorageState(err error) bool

func RetryOnUnexpectedStagesStorageState added in v1.2.77

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

Types

type CopyStageIntoStorageOptions added in v1.2.225

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 added in v1.2.225

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

type StagesList added in v1.2.16

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

func NewStagesList added in v1.2.16

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

func (*StagesList) AddStageID added in v1.2.16

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

func (*StagesList) GetStageIDs added in v1.2.16

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

type StorageManager

type StorageManager struct {
	ProjectName string

	StorageLockManager storage.LockManager

	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 storage.LockManager) *StorageManager

func (*StorageManager) CopyStage added in v1.2.225

func (*StorageManager) CopyStageIntoCacheStorages added in v1.2.77

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

func (*StorageManager) CopyStageIntoFinalStorage added in v1.2.77

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

func (*StorageManager) CopySuitableByDigestStage added in v1.2.13

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

func (*StorageManager) EnableParallel added in v1.2.0

func (m *StorageManager) EnableParallel(parallelTasksLimit int)

func (*StorageManager) FetchStage added in v1.2.13

func (m *StorageManager) FetchStage(ctx context.Context, containerBackend container_backend.ContainerBackend, stg stage.Interface) error

func (*StorageManager) ForEachDeleteFinalStage added in v1.2.16

func (m *StorageManager) ForEachDeleteFinalStage(ctx context.Context, options ForEachDeleteStageOptions, stagesDescriptions []*image.StageDescription, f func(ctx context.Context, stageDesc *image.StageDescription, err error) error) error

func (*StorageManager) ForEachDeleteStage added in v1.2.13

func (m *StorageManager) ForEachDeleteStage(ctx context.Context, options ForEachDeleteStageOptions, stagesDescriptions []*image.StageDescription, f func(ctx context.Context, stageDesc *image.StageDescription, err error) error) error

func (*StorageManager) ForEachDeleteStageCustomTag added in v1.2.81

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

func (*StorageManager) ForEachGetImportMetadata added in v1.2.13

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 added in v1.2.28

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) ForEachRmImageMetadata added in v1.2.13

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 added in v1.2.13

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 added in v1.2.13

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

func (*StorageManager) GenerateStageUniqueID added in v1.2.13

func (m *StorageManager) GenerateStageUniqueID(digest string, stages []*image.StageDescription) (string, int64)

func (*StorageManager) GetCacheStagesStorageList added in v1.2.225

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

func (*StorageManager) GetFinalStageDescriptionList added in v1.2.16

func (m *StorageManager) GetFinalStageDescriptionList(ctx context.Context) ([]*image.StageDescription, error)

func (*StorageManager) GetFinalStagesStorage added in v1.2.16

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

func (*StorageManager) GetImageInfo added in v1.2.190

func (m *StorageManager) GetImageInfo(ctx context.Context, ref string, opts StorageOptions) (*image.Info, error)

func (*StorageManager) GetImageInfoGetter added in v1.2.16

func (m *StorageManager) GetImageInfoGetter(imageName string, desc *image.StageDescription, opts image.InfoGetterOptions) *image.InfoGetter

func (*StorageManager) GetSecondaryStagesStorageList added in v1.2.16

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

func (*StorageManager) GetServiceValuesRepo added in v1.2.115

func (m *StorageManager) GetServiceValuesRepo() string

func (*StorageManager) GetStageDescriptionList added in v1.2.13

func (m *StorageManager) GetStageDescriptionList(ctx context.Context) ([]*image.StageDescription, error)

func (*StorageManager) GetStageDescriptionListWithCache added in v1.2.77

func (m *StorageManager) GetStageDescriptionListWithCache(ctx context.Context) ([]*image.StageDescription, error)

func (*StorageManager) GetStagesByDigest added in v1.2.13

func (m *StorageManager) GetStagesByDigest(ctx context.Context, stageName, stageDigest string) ([]*image.StageDescription, error)

func (*StorageManager) GetStagesByDigestFromStagesStorage added in v1.2.13

func (m *StorageManager) GetStagesByDigestFromStagesStorage(ctx context.Context, stageName, stageDigest string, stagesStorage storage.StagesStorage) ([]*image.StageDescription, error)

func (*StorageManager) GetStagesByDigestFromStagesStorageWithCache added in v1.2.77

func (m *StorageManager) GetStagesByDigestFromStagesStorageWithCache(ctx context.Context, stageName, stageDigest string, stagesStorage storage.StagesStorage) ([]*image.StageDescription, error)

func (*StorageManager) GetStagesByDigestWithCache added in v1.2.77

func (m *StorageManager) GetStagesByDigestWithCache(ctx context.Context, stageName, stageDigest string) ([]*image.StageDescription, error)

func (*StorageManager) GetStagesStorage added in v1.2.16

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

func (*StorageManager) InitCache added in v1.2.16

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

func (*StorageManager) LockStageImage added in v1.2.13

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

func (*StorageManager) MaxNumberOfWorkers added in v1.2.0

func (m *StorageManager) MaxNumberOfWorkers() int

func (*StorageManager) SelectSuitableStage added in v1.2.13

func (m *StorageManager) SelectSuitableStage(ctx context.Context, c stage.Conveyor, stg stage.Interface, stages []*image.StageDescription) (*image.StageDescription, error)

type StorageManagerInterface added in v1.2.16

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.StageDescription, opts image.InfoGetterOptions) *image.InfoGetter

	EnableParallel(parallelTasksLimit int)
	MaxNumberOfWorkers() int
	GenerateStageUniqueID(digest string, stages []*image.StageDescription) (string, int64)

	GetImageInfo(ctx context.Context, ref string, opts StorageOptions) (*image.Info, error)

	LockStageImage(ctx context.Context, imageName string) error
	GetStagesByDigest(ctx context.Context, stageName, stageDigest string) ([]*image.StageDescription, error)
	GetStagesByDigestWithCache(ctx context.Context, stageName, stageDigest string) ([]*image.StageDescription, error)
	GetStagesByDigestFromStagesStorage(ctx context.Context, stageName, stageDigest string, stagesStorage storage.StagesStorage) ([]*image.StageDescription, error)
	GetStagesByDigestFromStagesStorageWithCache(ctx context.Context, stageName, stageDigest string, stagesStorage storage.StagesStorage) ([]*image.StageDescription, error)
	GetStageDescriptionList(ctx context.Context) ([]*image.StageDescription, error)
	GetStageDescriptionListWithCache(ctx context.Context) ([]*image.StageDescription, error)
	GetFinalStageDescriptionList(ctx context.Context) ([]*image.StageDescription, error)

	FetchStage(ctx context.Context, containerBackend container_backend.ContainerBackend, stg stage.Interface) error
	SelectSuitableStage(ctx context.Context, c stage.Conveyor, stg stage.Interface, stages []*image.StageDescription) (*image.StageDescription, error)
	CopySuitableByDigestStage(ctx context.Context, stageDesc *image.StageDescription, sourceStagesStorage, destinationStagesStorage storage.StagesStorage, containerBackend container_backend.ContainerBackend, targetPlatform string) (*image.StageDescription, 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.StageDescription, error)

	ForEachDeleteStage(ctx context.Context, options ForEachDeleteStageOptions, stagesDescriptions []*image.StageDescription, f func(ctx context.Context, stageDesc *image.StageDescription, err error) error) error
	ForEachDeleteFinalStage(ctx context.Context, options ForEachDeleteStageOptions, stagesDescriptions []*image.StageDescription, f func(ctx context.Context, stageDesc *image.StageDescription, err error) 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 added in v1.2.190

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