storage

package
v1.1.20 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const (
	LocalStage_ImageRepoPrefix = "werf-stages-storage/"
	LocalStage_ImageRepoFormat = "werf-stages-storage/%s"
	LocalStage_ImageFormat     = "werf-stages-storage/%s:%s-%d"

	LocalManagedImageRecord_ImageNameFormat = "werf-managed-images/%s"
	LocalManagedImageRecord_ImageFormat     = "werf-managed-images/%s:%s"

	LocalImageMetadataByCommitRecord_ImageNameFormat = "werf-images-metadata-by-commit/%s"
	LocalImageMetadataByCommitRecord_ImageFormat     = "werf-images-metadata-by-commit/%s:%s-%s"
)
View Source
const (
	RepoStage_ImageFormat = "%s:%s-%d"

	RepoManagedImageRecord_ImageTagPrefix  = "managed-image-"
	RepoManagedImageRecord_ImageNameFormat = "%s:managed-image-%s"

	RepoImageMetadataByCommitRecord_ImageTagPrefix  = "image-metadata-by-commit-"
	RepoImageMetadataByCommitRecord_ImageNameFormat = "%s:image-metadata-by-commit-%s-%s"

	UnexpectedTagFormatErrorPrefix = "unexpected tag format"
)
View Source
const (
	LocalStorageAddress             = ":local"
	DefaultKubernetesStorageAddress = "kubernetes://werf-synchronization"
	NamelessImageRecordTag          = "__nameless__"
)
View Source
const (
	StagesStorageCacheConfigMapKey = "stagesStorageCache"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DeleteImageOptions

type DeleteImageOptions struct {
	RmiForce                 bool
	SkipUsedImage            bool
	RmForce                  bool
	RmContainersThatUseImage bool
}

type DockerImagesRepo

type DockerImagesRepo struct {
	docker_registry.DockerRegistry
	// contains filtered or unexported fields
}

func (*DockerImagesRepo) CreateImageRepo

func (repo *DockerImagesRepo) CreateImageRepo(imageName string) error

func (*DockerImagesRepo) DeleteImageRepo

func (repo *DockerImagesRepo) DeleteImageRepo(imageName string) error

func (*DockerImagesRepo) DeleteRepoImage

func (repo *DockerImagesRepo) DeleteRepoImage(_ DeleteImageOptions, repoImageList ...*image.Info) error

func (*DockerImagesRepo) GetAllImageRepoTags

func (repo *DockerImagesRepo) GetAllImageRepoTags(imageName string) ([]string, error)

func (*DockerImagesRepo) GetRepoImage

func (repo *DockerImagesRepo) GetRepoImage(imageName, tag string) (*image.Info, error)

func (*DockerImagesRepo) GetRepoImages

func (repo *DockerImagesRepo) GetRepoImages(imageNames []string) (map[string][]*image.Info, error)

func (DockerImagesRepo) ImageRepo

func (m DockerImagesRepo) ImageRepo(imageName string) string

func (DockerImagesRepo) ImageRepoTag

func (m DockerImagesRepo) ImageRepoTag(imageName, tag string) string

func (DockerImagesRepo) ImageRepoWithTag

func (m DockerImagesRepo) ImageRepoWithTag(imageName, tag string) string

func (*DockerImagesRepo) ImageRepositoryName

func (repo *DockerImagesRepo) ImageRepositoryName(imageName string) string

func (*DockerImagesRepo) ImageRepositoryNameWithTag

func (repo *DockerImagesRepo) ImageRepositoryNameWithTag(imageName, tag string) string

func (*DockerImagesRepo) ImageRepositoryTag

func (repo *DockerImagesRepo) ImageRepositoryTag(imageName, tag string) string

func (DockerImagesRepo) ImagesRepo

func (m DockerImagesRepo) ImagesRepo() string

func (DockerImagesRepo) IsMonorepo

func (m DockerImagesRepo) IsMonorepo() bool

func (*DockerImagesRepo) PublishImage

func (repo *DockerImagesRepo) PublishImage(publishImage *container_runtime.WerfImage) error

FIXME: use docker-registry object

func (*DockerImagesRepo) SelectRepoImages

func (repo *DockerImagesRepo) SelectRepoImages(imageNames []string, f func(string, *image.Info, error) (bool, error)) (map[string][]*image.Info, error)

func (*DockerImagesRepo) String

func (repo *DockerImagesRepo) String() string

type DockerImagesRepoOptions

type DockerImagesRepoOptions struct {
	docker_registry.DockerRegistryOptions
	Implementation string
}

type FileStagesStorageCache

type FileStagesStorageCache struct {
	CacheDir string
}

func NewFileStagesStorageCache

func NewFileStagesStorageCache(cacheDir string) *FileStagesStorageCache

func (*FileStagesStorageCache) DeleteAllStages

func (cache *FileStagesStorageCache) DeleteAllStages(projectName string) error

func (*FileStagesStorageCache) DeleteStagesBySignature

func (cache *FileStagesStorageCache) DeleteStagesBySignature(projectName, signature string) error

func (*FileStagesStorageCache) GetAllStages

func (cache *FileStagesStorageCache) GetAllStages(projectName string) (bool, []image.StageID, error)

func (*FileStagesStorageCache) GetStagesBySignature

func (cache *FileStagesStorageCache) GetStagesBySignature(projectName, signature string) (bool, []image.StageID, error)

func (*FileStagesStorageCache) StoreStagesBySignature

func (cache *FileStagesStorageCache) StoreStagesBySignature(projectName, signature string, stages []image.StageID) error

func (*FileStagesStorageCache) String

func (cache *FileStagesStorageCache) String() string

type GenericLockManager

type GenericLockManager struct {
	// Single Locker for all projects
	Locker lockgate.Locker
}

func NewGenericLockManager

func NewGenericLockManager(locker lockgate.Locker) *GenericLockManager

func (*GenericLockManager) LockDeployProcess

func (manager *GenericLockManager) LockDeployProcess(projectName string, releaseName string, kubeContextName string) (LockHandle, error)

func (*GenericLockManager) LockImage

func (manager *GenericLockManager) LockImage(projectName, imageName string) (LockHandle, error)

func (*GenericLockManager) LockStage

func (manager *GenericLockManager) LockStage(projectName, signature string) (LockHandle, error)

func (*GenericLockManager) LockStageCache

func (manager *GenericLockManager) LockStageCache(projectName, signature string) (LockHandle, error)

func (*GenericLockManager) LockStagesAndImages

func (manager *GenericLockManager) LockStagesAndImages(projectName string, opts LockStagesAndImagesOptions) (LockHandle, error)

func (*GenericLockManager) Unlock

func (manager *GenericLockManager) Unlock(lock LockHandle) error

type ImageMetadata

type ImageMetadata struct {
	ContentSignature string
}

type ImagesRepo

type ImagesRepo interface {
	GetRepoImage(imageName, tag string) (*image.Info, error)
	GetRepoImages(imageNames []string) (map[string][]*image.Info, error)
	SelectRepoImages(imageNames []string, f func(string, *image.Info, error) (bool, error)) (map[string][]*image.Info, error)
	DeleteRepoImage(_ DeleteImageOptions, repoImageList ...*image.Info) error

	GetAllImageRepoTags(imageName string) ([]string, error)
	PublishImage(publishImage *container_runtime.WerfImage) error

	CreateImageRepo(imageName string) error
	DeleteImageRepo(imageName string) error

	ImageRepositoryName(imageName string) string
	ImageRepositoryNameWithTag(imageName, tag string) string
	ImageRepositoryTag(imageName, tag string) string

	String() string
}

func NewDockerImagesRepo

func NewDockerImagesRepo(projectName, imagesRepoAddress, imagesRepoMode string, options DockerImagesRepoOptions) (ImagesRepo, error)

func NewImagesRepo

func NewImagesRepo(projectName, imagesRepoAddress, imagesRepoMode string, options ImagesRepoOptions) (ImagesRepo, error)

type ImagesRepoOptions

type ImagesRepoOptions struct {
	DockerImagesRepoOptions
}

type KubernetesStagesStorageCache

type KubernetesStagesStorageCache struct {
	Namespace string
}

func NewKubernetesStagesStorageCache

func NewKubernetesStagesStorageCache(namespace string) *KubernetesStagesStorageCache

func (*KubernetesStagesStorageCache) DeleteAllStages

func (cache *KubernetesStagesStorageCache) DeleteAllStages(projectName string) error

func (*KubernetesStagesStorageCache) DeleteStagesBySignature

func (cache *KubernetesStagesStorageCache) DeleteStagesBySignature(projectName, signature string) error

func (*KubernetesStagesStorageCache) GetAllStages

func (cache *KubernetesStagesStorageCache) GetAllStages(projectName string) (bool, []image.StageID, error)

func (*KubernetesStagesStorageCache) GetStagesBySignature

func (cache *KubernetesStagesStorageCache) GetStagesBySignature(projectName, signature string) (bool, []image.StageID, error)

func (*KubernetesStagesStorageCache) StoreStagesBySignature

func (cache *KubernetesStagesStorageCache) StoreStagesBySignature(projectName, signature string, stages []image.StageID) error

func (*KubernetesStagesStorageCache) String

func (cache *KubernetesStagesStorageCache) String() string

type KubernetesStagesStorageCacheData

type KubernetesStagesStorageCacheData struct {
	StagesBySignature map[string][]image.StageID `json:"stagesBySignature"`
}

type KuberntesLockManager

type KuberntesLockManager struct {
	Namespace        string
	LockerPerProject map[string]lockgate.Locker
	// contains filtered or unexported fields
}

func NewKubernetesLockManager

func NewKubernetesLockManager(namespace string) *KuberntesLockManager

func (*KuberntesLockManager) LockDeployProcess

func (manager *KuberntesLockManager) LockDeployProcess(projectName string, releaseName string, kubeContextName string) (LockHandle, error)

func (*KuberntesLockManager) LockImage

func (manager *KuberntesLockManager) LockImage(projectName, imageName string) (LockHandle, error)

func (*KuberntesLockManager) LockStage

func (manager *KuberntesLockManager) LockStage(projectName, signature string) (LockHandle, error)

func (*KuberntesLockManager) LockStageCache

func (manager *KuberntesLockManager) LockStageCache(projectName, signature string) (LockHandle, error)

func (*KuberntesLockManager) LockStagesAndImages

func (manager *KuberntesLockManager) LockStagesAndImages(projectName string, opts LockStagesAndImagesOptions) (LockHandle, error)

func (*KuberntesLockManager) Unlock

func (manager *KuberntesLockManager) Unlock(lock LockHandle) error

type LocalDockerServerStagesStorage

type LocalDockerServerStagesStorage struct {
	// Local stages storage is compatible only with docker-server backed runtime
	LocalDockerServerRuntime *container_runtime.LocalDockerServerRuntime
}

func NewLocalDockerServerStagesStorage

func NewLocalDockerServerStagesStorage(localDockerServerRuntime *container_runtime.LocalDockerServerRuntime) *LocalDockerServerStagesStorage

func (*LocalDockerServerStagesStorage) AddManagedImage

func (storage *LocalDockerServerStagesStorage) AddManagedImage(projectName, imageName string) error

func (*LocalDockerServerStagesStorage) Address

func (storage *LocalDockerServerStagesStorage) Address() string

func (*LocalDockerServerStagesStorage) ConstructStageImageName

func (storage *LocalDockerServerStagesStorage) ConstructStageImageName(projectName, signature string, uniqueID int64) string

func (*LocalDockerServerStagesStorage) CreateRepo

func (storage *LocalDockerServerStagesStorage) CreateRepo() error

func (*LocalDockerServerStagesStorage) DeleteRepo

func (storage *LocalDockerServerStagesStorage) DeleteRepo() error

func (*LocalDockerServerStagesStorage) DeleteStages

func (storage *LocalDockerServerStagesStorage) DeleteStages(options DeleteImageOptions, stages ...*image.StageDescription) error

func (*LocalDockerServerStagesStorage) FetchImage

func (*LocalDockerServerStagesStorage) GetAllStages

func (storage *LocalDockerServerStagesStorage) GetAllStages(projectName string) ([]image.StageID, error)

func (*LocalDockerServerStagesStorage) GetImageCommits

func (storage *LocalDockerServerStagesStorage) GetImageCommits(projectName, imageName string) ([]string, error)

func (*LocalDockerServerStagesStorage) GetImageMetadataByCommit

func (storage *LocalDockerServerStagesStorage) GetImageMetadataByCommit(projectName, imageName, commit string) (*ImageMetadata, error)

func (*LocalDockerServerStagesStorage) GetManagedImages

func (storage *LocalDockerServerStagesStorage) GetManagedImages(projectName string) ([]string, error)

func (*LocalDockerServerStagesStorage) GetStageDescription

func (storage *LocalDockerServerStagesStorage) GetStageDescription(projectName, signature string, uniqueID int64) (*image.StageDescription, error)

func (*LocalDockerServerStagesStorage) GetStagesBySignature

func (storage *LocalDockerServerStagesStorage) GetStagesBySignature(projectName, signature string) ([]image.StageID, error)

func (*LocalDockerServerStagesStorage) PutImageCommit

func (storage *LocalDockerServerStagesStorage) PutImageCommit(projectName, imageName, commit string, metadata *ImageMetadata) error

func (*LocalDockerServerStagesStorage) RmImageCommit

func (storage *LocalDockerServerStagesStorage) RmImageCommit(projectName, imageName, commit string) error

func (*LocalDockerServerStagesStorage) RmManagedImage

func (storage *LocalDockerServerStagesStorage) RmManagedImage(projectName, imageName string) error

func (*LocalDockerServerStagesStorage) ShouldFetchImage

func (storage *LocalDockerServerStagesStorage) ShouldFetchImage(_ container_runtime.Image) (bool, error)

func (*LocalDockerServerStagesStorage) StoreImage

func (*LocalDockerServerStagesStorage) String

func (storage *LocalDockerServerStagesStorage) String() string

type LockHandle

type LockHandle struct {
	ProjectName    string
	LockgateHandle lockgate.LockHandle
}

type LockManager

type LockManager interface {
	LockStage(projectName, signature string) (LockHandle, error)
	LockStageCache(projectName, signature string) (LockHandle, error)
	LockImage(projectName, imageName string) (LockHandle, error)
	LockStagesAndImages(projectName string, opts LockStagesAndImagesOptions) (LockHandle, error)
	LockDeployProcess(projectName string, releaseName string, kubeContextName string) (LockHandle, error)
	Unlock(lock LockHandle) error
}

type LockStagesAndImagesOptions

type LockStagesAndImagesOptions struct {
	GetOrCreateImagesOnly bool
}

type RepoStagesStorage

type RepoStagesStorage struct {
	RepoAddress      string
	DockerRegistry   docker_registry.DockerRegistry
	ContainerRuntime container_runtime.ContainerRuntime
}

func NewRepoStagesStorage

func NewRepoStagesStorage(repoAddress string, containerRuntime container_runtime.ContainerRuntime, options RepoStagesStorageOptions) (*RepoStagesStorage, error)

func (*RepoStagesStorage) AddManagedImage

func (storage *RepoStagesStorage) AddManagedImage(projectName, imageName string) error

func (*RepoStagesStorage) Address

func (storage *RepoStagesStorage) Address() string

func (*RepoStagesStorage) ConstructStageImageName

func (storage *RepoStagesStorage) ConstructStageImageName(projectName, signature string, uniqueID int64) string

func (*RepoStagesStorage) CreateRepo

func (storage *RepoStagesStorage) CreateRepo() error

func (*RepoStagesStorage) DeleteRepo

func (storage *RepoStagesStorage) DeleteRepo() error

func (*RepoStagesStorage) DeleteStages

func (storage *RepoStagesStorage) DeleteStages(options DeleteImageOptions, stages ...*image.StageDescription) error

func (*RepoStagesStorage) FetchImage

func (storage *RepoStagesStorage) FetchImage(img container_runtime.Image) error

func (*RepoStagesStorage) GetAllStages

func (storage *RepoStagesStorage) GetAllStages(projectName string) ([]image.StageID, error)

func (*RepoStagesStorage) GetImageCommits

func (storage *RepoStagesStorage) GetImageCommits(projectName, imageName string) ([]string, error)

func (*RepoStagesStorage) GetImageMetadataByCommit

func (storage *RepoStagesStorage) GetImageMetadataByCommit(projectName, imageName, commit string) (*ImageMetadata, error)

func (*RepoStagesStorage) GetManagedImages

func (storage *RepoStagesStorage) GetManagedImages(projectName string) ([]string, error)

func (*RepoStagesStorage) GetStageDescription

func (storage *RepoStagesStorage) GetStageDescription(projectName, signature string, uniqueID int64) (*image.StageDescription, error)

func (*RepoStagesStorage) GetStagesBySignature

func (storage *RepoStagesStorage) GetStagesBySignature(projectName, signature string) ([]image.StageID, error)

func (*RepoStagesStorage) PutImageCommit

func (storage *RepoStagesStorage) PutImageCommit(projectName, imageName, commit string, metadata *ImageMetadata) error

func (*RepoStagesStorage) RmImageCommit

func (storage *RepoStagesStorage) RmImageCommit(projectName, imageName, commit string) error

func (*RepoStagesStorage) RmManagedImage

func (storage *RepoStagesStorage) RmManagedImage(projectName, imageName string) error

func (*RepoStagesStorage) ShouldFetchImage

func (storage *RepoStagesStorage) ShouldFetchImage(img container_runtime.Image) (bool, error)

func (*RepoStagesStorage) StoreImage

func (storage *RepoStagesStorage) StoreImage(img container_runtime.Image) error

func (*RepoStagesStorage) String

func (storage *RepoStagesStorage) String() string

type RepoStagesStorageOptions

type RepoStagesStorageOptions struct {
	docker_registry.DockerRegistryOptions
	Implementation string
}

type StagesStorage

type StagesStorage interface {
	GetAllStages(projectName string) ([]image.StageID, error)
	GetStagesBySignature(projectName, signature string) ([]image.StageID, error)
	GetStageDescription(projectName, signature string, uniqueID int64) (*image.StageDescription, error)
	DeleteStages(options DeleteImageOptions, stages ...*image.StageDescription) error

	ConstructStageImageName(projectName, signature string, uniqueID int64) string

	// FetchImage will create a local image in the container-runtime
	FetchImage(img container_runtime.Image) error
	// StoreImage will store a local image into the container-runtime, local built image should exist prior running store
	StoreImage(img container_runtime.Image) error
	ShouldFetchImage(img container_runtime.Image) (bool, error)

	CreateRepo() error
	DeleteRepo() error

	AddManagedImage(projectName, imageName string) error
	RmManagedImage(projectName, imageName string) error
	GetManagedImages(projectName string) ([]string, error)

	PutImageCommit(projectName, imageName, commit string, metadata *ImageMetadata) error
	RmImageCommit(projectName, imageName, commit string) error
	GetImageCommits(projectName, imageName string) ([]string, error)
	GetImageMetadataByCommit(projectName, imageName, commit string) (*ImageMetadata, error)

	String() string
	Address() string
}

func NewStagesStorage

func NewStagesStorage(stagesStorageAddress string, containerRuntime container_runtime.ContainerRuntime, options StagesStorageOptions) (StagesStorage, error)

type StagesStorageCache

type StagesStorageCache interface {
	GetAllStages(projectName string) (bool, []image.StageID, error)
	DeleteAllStages(projectName string) error
	GetStagesBySignature(projectName, signature string) (bool, []image.StageID, error)
	StoreStagesBySignature(projectName, signature string, stages []image.StageID) error
	DeleteStagesBySignature(projectName, signature string) error

	String() string
}

type StagesStorageCacheRecord

type StagesStorageCacheRecord struct {
	Stages []image.StageID `json:"stages"`
}

type StagesStorageOptions

type StagesStorageOptions struct {
	RepoStagesStorageOptions
}

Jump to

Keyboard shortcuts

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