2019-06-20 16:36:40 -07:00
|
|
|
package storage
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
2021-12-21 15:19:40 +02:00
|
|
|
"time"
|
2019-06-20 16:36:40 -07:00
|
|
|
|
2022-10-22 23:46:13 +03:00
|
|
|
godigest "github.com/opencontainers/go-digest"
|
2022-11-08 00:38:16 -08:00
|
|
|
ispec "github.com/opencontainers/image-spec/specs-go/v1"
|
2022-01-31 21:33:07 +00:00
|
|
|
artifactspec "github.com/oras-project/artifacts-spec/specs-go/v1"
|
2022-10-20 19:39:20 +03:00
|
|
|
|
2022-09-23 08:27:56 +03:00
|
|
|
"zotregistry.io/zot/pkg/scheduler"
|
2019-06-20 16:36:40 -07:00
|
|
|
)
|
|
|
|
|
2021-07-17 06:53:05 +03:00
|
|
|
const (
|
|
|
|
S3StorageDriverName = "s3"
|
2022-02-10 00:51:35 +00:00
|
|
|
DefaultGCDelay = 1 * time.Hour
|
2021-07-17 06:53:05 +03:00
|
|
|
)
|
|
|
|
|
2022-10-05 13:21:14 +03:00
|
|
|
type ImageStore interface { //nolint:interfacebloat
|
2021-09-30 16:27:13 +03:00
|
|
|
DirExists(d string) bool
|
|
|
|
RootDir() string
|
2021-12-21 15:19:40 +02:00
|
|
|
RLock(*time.Time)
|
|
|
|
RUnlock(*time.Time)
|
|
|
|
Lock(*time.Time)
|
|
|
|
Unlock(*time.Time)
|
2021-09-30 16:27:13 +03:00
|
|
|
InitRepo(name string) error
|
|
|
|
ValidateRepo(name string) (bool, error)
|
|
|
|
GetRepositories() ([]string, error)
|
2022-09-23 08:27:56 +03:00
|
|
|
GetNextRepository(repo string) (string, error)
|
2021-09-30 16:27:13 +03:00
|
|
|
GetImageTags(repo string) ([]string, error)
|
2022-10-22 23:46:13 +03:00
|
|
|
GetImageManifest(repo, reference string) ([]byte, godigest.Digest, string, error)
|
|
|
|
PutImageManifest(repo, reference, mediaType string, body []byte) (godigest.Digest, error)
|
2022-11-18 19:35:28 +02:00
|
|
|
DeleteImageManifest(repo, reference string, detectCollision bool) error
|
2022-03-21 17:37:23 +00:00
|
|
|
BlobUploadPath(repo, uuid string) string
|
2021-09-30 16:27:13 +03:00
|
|
|
NewBlobUpload(repo string) (string, error)
|
2022-03-21 17:37:23 +00:00
|
|
|
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)
|
2022-10-22 23:46:13 +03:00
|
|
|
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
|
2022-03-21 17:37:23 +00:00
|
|
|
DeleteBlobUpload(repo, uuid string) error
|
2022-10-22 23:46:13 +03:00
|
|
|
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
|
2021-09-30 16:27:13 +03:00
|
|
|
GetIndexContent(repo string) ([]byte, error)
|
2022-10-22 23:46:13 +03:00
|
|
|
GetBlobContent(repo string, digest godigest.Digest) ([]byte, error)
|
2022-11-08 00:38:16 -08:00
|
|
|
GetReferrers(repo string, digest godigest.Digest, artifactType string) (ispec.Index, error)
|
|
|
|
GetOrasReferrers(repo string, digest godigest.Digest, artifactType string) ([]artifactspec.Descriptor, error)
|
2022-09-23 08:27:56 +03:00
|
|
|
RunGCRepo(repo string) error
|
|
|
|
RunGCPeriodically(interval time.Duration, sch *scheduler.Scheduler)
|
2020-06-30 10:56:58 -07:00
|
|
|
}
|