storage

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

README

zot currently supports two types of underlying filesystems:

  1. local - a locally mounted filesystem

  2. remote - a remote filesystem such as AWS S3

The cache database can be configured independently of storage. Right now, zot supports the following database implementations:

  1. BoltDB - local storage. Set the "cloudCache" field in the config file to false. Example: examples/config-boltdb.json

Documentation

Index

Constants

View Source
const (
	S3StorageDriverName = "s3"
	DefaultGCDelay      = 1 * time.Hour
)

Variables

This section is empty.

Functions

func ApplyLinter added in v1.4.3

func ApplyLinter(imgStore ImageStore, linter Lint, repo string, manifestDesc ispec.Descriptor) (bool, error)

func CheckIfIndexNeedsUpdate added in v1.4.3

func CheckIfIndexNeedsUpdate(index *ispec.Index, desc *ispec.Descriptor,
	log zerolog.Logger,
) (bool, godigest.Digest, error)

CheckIfIndexNeedsUpdate verifies if an index needs to be updated given a new manifest descriptor.

Returns whether or not index needs update, in the latter case it will also return the previous digest.

func Create added in v1.4.3

func Create(dbtype string, parameters interface{}, log zlog.Logger) (cache.Cache, error)

func GetAndValidateRequestDigest added in v1.4.3

func GetAndValidateRequestDigest(body []byte, digestStr string, log zerolog.Logger) (godigest.Digest, error)

func GetImageIndex added in v1.4.3

func GetImageIndex(imgStore ImageStore, repo string, digest godigest.Digest, log zerolog.Logger) (ispec.Index, error)

GetImageIndex returns a multiarch type image.

func GetIndex added in v1.4.3

func GetIndex(imgStore ImageStore, repo string, log zerolog.Logger) (ispec.Index, error)

GetIndex returns the contents of index.json.

func GetManifestDescByReference added in v1.4.3

func GetManifestDescByReference(index ispec.Index, reference string) (ispec.Descriptor, bool)

func GetOrasManifestByDigest added in v1.4.3

func GetOrasManifestByDigest(imgStore ImageStore, repo string, digest godigest.Digest, log zerolog.Logger,
) (oras.Manifest, error)

func GetOrasReferrers added in v1.4.3

func GetOrasReferrers(imgStore ImageStore, repo string, gdigest godigest.Digest, artifactType string,
	log zerolog.Logger,
) ([]oras.Descriptor, error)

func GetReferrers added in v1.4.3

func GetReferrers(imgStore ImageStore, repo string, gdigest godigest.Digest, artifactType string,
	log zerolog.Logger,
) (ispec.Index, error)

func GetTagsByIndex added in v1.4.3

func GetTagsByIndex(index ispec.Index) []string

func IsSupportedMediaType

func IsSupportedMediaType(mediaType string) bool

func PruneImageManifestsFromIndex added in v1.4.3

func PruneImageManifestsFromIndex(imgStore ImageStore, repo string, digest godigest.Digest,
	outIndex ispec.Index, otherImgIndexes []ispec.Descriptor, log zerolog.Logger,
) ([]ispec.Descriptor, error)

Before an image index manifest is pushed to a repo, its constituent manifests are pushed first, so when updating/removing this image index manifest, we also need to determine if there are other image index manifests which refer to the same constitutent manifests so that they can be garbage-collected correctly

PruneImageManifestsFromIndex is a helper routine to achieve this.

func RemoveManifestDescByReference added in v1.4.3

func RemoveManifestDescByReference(index *ispec.Index, reference string, detectCollisions bool,
) (ispec.Descriptor, error)

func UpdateIndexWithPrunedImageManifests added in v1.4.3

func UpdateIndexWithPrunedImageManifests(imgStore ImageStore, index *ispec.Index, repo string,
	desc ispec.Descriptor, oldDgst godigest.Digest, log zerolog.Logger,
) error

Unmarshal an image index and for all manifests in that index, ensure that they do not have a name or they are not in other manifest indexes else GC can never clean them.

func ValidateManifest added in v1.4.3

func ValidateManifest(imgStore ImageStore, repo, reference, mediaType string, body []byte,
	log zerolog.Logger,
) (godigest.Digest, error)

Types

type BlobUpload

type BlobUpload struct {
	StoreName string
	ID        string
}

BlobUpload models and upload request.

type ImageStore

type ImageStore interface {
	DirExists(d string) bool
	RootDir() string
	RLock(*time.Time)
	RUnlock(*time.Time)
	Lock(*time.Time)
	Unlock(*time.Time)
	InitRepo(name string) error
	ValidateRepo(name string) (bool, error)
	GetRepositories() ([]string, error)
	GetNextRepository(repo string) (string, error)
	GetImageTags(repo string) ([]string, error)
	GetImageManifest(repo, reference string) ([]byte, godigest.Digest, string, error)
	PutImageManifest(repo, reference, mediaType string, body []byte) (godigest.Digest, error)
	DeleteImageManifest(repo, reference string, detectCollision bool) error
	BlobUploadPath(repo, uuid string) string
	NewBlobUpload(repo string) (string, error)
	GetBlobUpload(repo, uuid string) (int64, error)
	PutBlobChunkStreamed(repo, uuid string, body io.Reader) (int64, error)
	PutBlobChunk(repo, uuid string, from, to int64, body io.Reader) (int64, error)
	BlobUploadInfo(repo, uuid string) (int64, error)
	FinishBlobUpload(repo, uuid string, body io.Reader, digest godigest.Digest) error
	FullBlobUpload(repo string, body io.Reader, digest godigest.Digest) (string, int64, error)
	DedupeBlob(src string, dstDigest godigest.Digest, dst string) error
	DeleteBlobUpload(repo, uuid string) error
	BlobPath(repo string, digest godigest.Digest) string
	CheckBlob(repo string, digest godigest.Digest) (bool, int64, error)
	GetBlob(repo string, digest godigest.Digest, mediaType string) (io.ReadCloser, int64, error)
	GetBlobPartial(repo string, digest godigest.Digest, mediaType string, from, to int64,
	) (io.ReadCloser, int64, int64, error)
	DeleteBlob(repo string, digest godigest.Digest) error
	GetIndexContent(repo string) ([]byte, error)
	GetBlobContent(repo string, digest godigest.Digest) ([]byte, error)
	GetReferrers(repo string, digest godigest.Digest, artifactType string) (ispec.Index, error)
	GetOrasReferrers(repo string, digest godigest.Digest, artifactType string) ([]artifactspec.Descriptor, error)
	RunGCRepo(repo string) error
	RunGCPeriodically(interval time.Duration, sch *scheduler.Scheduler)
}

type Lint added in v1.4.2

type Lint interface {
	Lint(repo string, manifestDigest godigest.Digest, imageStore ImageStore) (bool, error)
}

type ScrubImageResult added in v1.3.6

type ScrubImageResult struct {
	ImageName string `json:"imageName"`
	Tag       string `json:"tag"`
	Status    string `json:"status"`
	Error     string `json:"error"`
}

func CheckImageStoreBlobsIntegrity added in v1.4.0

func CheckImageStoreBlobsIntegrity(imgStore ImageStore) ([]ScrubImageResult, error)

func CheckRepo added in v1.4.1

func CheckRepo(imageName string, imgStore ImageStore) ([]ScrubImageResult, error)

type ScrubResults added in v1.3.6

type ScrubResults struct {
	ScrubResults []ScrubImageResult `json:"scrubResults"`
}

func (ScrubResults) PrintScrubResults added in v1.3.6

func (results ScrubResults) PrintScrubResults(resultWriter io.Writer)

type StoreController

type StoreController struct {
	DefaultStore ImageStore
	SubStore     map[string]ImageStore
}

func (StoreController) CheckAllBlobsIntegrity added in v1.3.6

func (sc StoreController) CheckAllBlobsIntegrity() (ScrubResults, error)

func (StoreController) GetImageStore

func (sc StoreController) GetImageStore(name string) ImageStore

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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