storage

package
v1.1.10-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

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

	LocalManagedImageRecord_ImageNamePrefix = "werf-managed-images/"
	LocalManagedImageRecord_ImageNameFormat = "werf-managed-images/%s"
	LocalManagedImageRecord_ImageFormat     = "werf-managed-images/%s:%s"
)
View Source
const (
	RepoStage_ImageTagFormat = "%s-%s"
	RepoStage_ImageFormat    = "%s:%s-%s"

	RepoManagedImageRecord_ImageTagPrefix  = "managed-image-"
	RepoManagedImageRecord_ImageTagFormat  = "managed-image-%s"
	RepoManagedImageRecord_ImageNameFormat = "%s:managed-image-%s"
)
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 added in v1.1.9

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

type DockerImagesRepo added in v1.1.9

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

func (*DockerImagesRepo) CreateImageRepo added in v1.1.9

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

func (*DockerImagesRepo) DeleteImageRepo added in v1.1.9

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

func (*DockerImagesRepo) DeleteRepoImage added in v1.1.9

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

func (*DockerImagesRepo) GetAllImageRepoTags added in v1.1.9

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

func (*DockerImagesRepo) GetRepoImage added in v1.1.9

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

func (*DockerImagesRepo) GetRepoImages added in v1.1.9

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

func (DockerImagesRepo) ImageRepo added in v1.1.9

func (m DockerImagesRepo) ImageRepo(imageName string) string

func (DockerImagesRepo) ImageRepoTag added in v1.1.9

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

func (DockerImagesRepo) ImageRepoWithTag added in v1.1.9

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

func (*DockerImagesRepo) ImageRepositoryName added in v1.1.9

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

func (*DockerImagesRepo) ImageRepositoryNameWithTag added in v1.1.9

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

func (*DockerImagesRepo) ImageRepositoryTag added in v1.1.9

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

func (DockerImagesRepo) ImagesRepo added in v1.1.9

func (m DockerImagesRepo) ImagesRepo() string

func (DockerImagesRepo) IsMonorepo added in v1.1.9

func (m DockerImagesRepo) IsMonorepo() bool

func (*DockerImagesRepo) PublishImage added in v1.1.9

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

FIXME: use docker-registry object

func (*DockerImagesRepo) SelectRepoImages added in v1.1.10

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

func (*DockerImagesRepo) String added in v1.1.9

func (repo *DockerImagesRepo) String() string

type DockerImagesRepoOptions added in v1.1.9

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

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

func (*FileStagesStorageCache) DeleteStagesBySignature added in v1.1.9

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

func (*FileStagesStorageCache) GetAllStages added in v1.1.9

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

func (*FileStagesStorageCache) GetStagesBySignature added in v1.1.9

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

func (*FileStagesStorageCache) StoreStagesBySignature added in v1.1.9

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

func (*FileStagesStorageCache) String added in v1.1.10

func (cache *FileStagesStorageCache) String() string

type GenericLockManager added in v1.1.10

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

func NewGenericLockManager added in v1.1.10

func NewGenericLockManager(locker lockgate.Locker) *GenericLockManager

func (*GenericLockManager) LockImage added in v1.1.10

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

func (*GenericLockManager) LockStage added in v1.1.10

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

func (*GenericLockManager) LockStageCache added in v1.1.10

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

func (*GenericLockManager) LockStagesAndImages added in v1.1.10

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

func (*GenericLockManager) Unlock added in v1.1.10

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

type ImagesRepo added in v1.1.9

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

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

func NewImagesRepo added in v1.1.9

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

type ImagesRepoOptions added in v1.1.9

type ImagesRepoOptions struct {
	DockerImagesRepoOptions
}

type KubernetesStagesStorageCache added in v1.1.10

type KubernetesStagesStorageCache struct {
	Namespace string
}

func NewKubernetesStagesStorageCache added in v1.1.10

func NewKubernetesStagesStorageCache(namespace string) *KubernetesStagesStorageCache

func (*KubernetesStagesStorageCache) DeleteAllStages added in v1.1.10

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

func (*KubernetesStagesStorageCache) DeleteStagesBySignature added in v1.1.10

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

func (*KubernetesStagesStorageCache) GetAllStages added in v1.1.10

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

func (*KubernetesStagesStorageCache) GetStagesBySignature added in v1.1.10

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

func (*KubernetesStagesStorageCache) StoreStagesBySignature added in v1.1.10

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

func (*KubernetesStagesStorageCache) String added in v1.1.10

func (cache *KubernetesStagesStorageCache) String() string

type KubernetesStagesStorageCacheData added in v1.1.10

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

type KuberntesLockManager added in v1.1.10

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

func NewKubernetesLockManager added in v1.1.10

func NewKubernetesLockManager(namespace string) *KuberntesLockManager

func (*KuberntesLockManager) LockImage added in v1.1.10

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

func (*KuberntesLockManager) LockStage added in v1.1.10

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

func (*KuberntesLockManager) LockStageCache added in v1.1.10

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

func (*KuberntesLockManager) LockStagesAndImages added in v1.1.10

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

func (*KuberntesLockManager) Unlock added in v1.1.10

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

type LocalDockerServerStagesStorage added in v1.1.9

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

func NewLocalDockerServerStagesStorage added in v1.1.9

func NewLocalDockerServerStagesStorage(localDockerServerRuntime *container_runtime.LocalDockerServerRuntime) *LocalDockerServerStagesStorage

func (*LocalDockerServerStagesStorage) AddManagedImage added in v1.1.9

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

func (*LocalDockerServerStagesStorage) Address added in v1.1.9

func (storage *LocalDockerServerStagesStorage) Address() string

func (*LocalDockerServerStagesStorage) ConstructStageImageName added in v1.1.9

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

func (*LocalDockerServerStagesStorage) CreateRepo added in v1.1.9

func (storage *LocalDockerServerStagesStorage) CreateRepo() error

func (*LocalDockerServerStagesStorage) DeleteRepo added in v1.1.9

func (storage *LocalDockerServerStagesStorage) DeleteRepo() error

func (*LocalDockerServerStagesStorage) DeleteStages added in v1.1.9

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

func (*LocalDockerServerStagesStorage) FetchImage added in v1.1.9

func (*LocalDockerServerStagesStorage) GetAllStages added in v1.1.9

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

func (*LocalDockerServerStagesStorage) GetManagedImages added in v1.1.9

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

func (*LocalDockerServerStagesStorage) GetStageDescription added in v1.1.9

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

func (*LocalDockerServerStagesStorage) GetStagesBySignature added in v1.1.9

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

func (*LocalDockerServerStagesStorage) RmManagedImage added in v1.1.9

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

func (*LocalDockerServerStagesStorage) ShouldFetchImage added in v1.1.9

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

func (*LocalDockerServerStagesStorage) StoreImage added in v1.1.9

func (*LocalDockerServerStagesStorage) String added in v1.1.9

func (storage *LocalDockerServerStagesStorage) String() string

type LockHandle added in v1.1.10

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)
	Unlock(lock LockHandle) error
}

type LockStagesAndImagesOptions added in v1.1.9

type LockStagesAndImagesOptions struct {
	GetOrCreateImagesOnly bool
}

type RepoStagesStorage added in v1.1.9

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

func NewRepoStagesStorage added in v1.1.9

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

func (*RepoStagesStorage) AddManagedImage added in v1.1.9

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

func (*RepoStagesStorage) Address added in v1.1.9

func (storage *RepoStagesStorage) Address() string

func (*RepoStagesStorage) ConstructStageImageName added in v1.1.9

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

func (*RepoStagesStorage) CreateRepo added in v1.1.9

func (storage *RepoStagesStorage) CreateRepo() error

func (*RepoStagesStorage) DeleteRepo added in v1.1.9

func (storage *RepoStagesStorage) DeleteRepo() error

func (*RepoStagesStorage) DeleteStages added in v1.1.9

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

func (*RepoStagesStorage) FetchImage added in v1.1.9

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

func (*RepoStagesStorage) GetAllStages added in v1.1.9

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

func (*RepoStagesStorage) GetManagedImages added in v1.1.9

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

func (*RepoStagesStorage) GetStageDescription added in v1.1.9

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

func (*RepoStagesStorage) GetStagesBySignature added in v1.1.9

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

func (*RepoStagesStorage) RmManagedImage added in v1.1.9

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

func (*RepoStagesStorage) ShouldFetchImage added in v1.1.9

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

func (*RepoStagesStorage) StoreImage added in v1.1.9

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

func (*RepoStagesStorage) String added in v1.1.9

func (storage *RepoStagesStorage) String() string

type RepoStagesStorageOptions added in v1.1.9

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, uniqueID string) (*image.StageDescription, error)
	DeleteStages(options DeleteImageOptions, stages ...*image.StageDescription) error

	ConstructStageImageName(projectName, signature, uniqueID string) 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)

	String() string
	Address() string
}

func NewStagesStorage added in v1.1.9

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

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

type StagesStorageOptions added in v1.1.9

type StagesStorageOptions struct {
	RepoStagesStorageOptions
}

Jump to

Keyboard shortcuts

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