wip: oci image management
This commit is contained in:
34
handler/interfaces.go
Normal file
34
handler/interfaces.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
"gitea.loveuer.com/loveuer/cluster/internal/rerr"
|
||||
"gitea.loveuer.com/loveuer/cluster/internal/model"
|
||||
)
|
||||
|
||||
// BlobHandler handles blob operations
|
||||
type BlobHandler interface {
|
||||
Get(ctx context.Context, repo string, h model.Hash) (io.ReadCloser, error)
|
||||
Put(ctx context.Context, repo string, h model.Hash, rc io.ReadCloser) error
|
||||
Stat(ctx context.Context, repo string, h model.Hash) (int64, error)
|
||||
Delete(ctx context.Context, repo string, h model.Hash) error
|
||||
}
|
||||
|
||||
// UploadHandler handles upload operations
|
||||
type UploadHandler interface {
|
||||
UploadId() string
|
||||
Write(ctx context.Context, sessionID string, r io.Reader, start, end int) (int, *rerr.RepositoryError)
|
||||
Done(ctx context.Context, blobHandler BlobHandler, sessionID string, r io.Reader, contentLength int, repo string, h model.Hash) *rerr.RepositoryError
|
||||
}
|
||||
|
||||
// ManifestHandler handles manifest operations
|
||||
type ManifestHandler interface {
|
||||
Get(ctx context.Context, repo, tag string) (io.ReadCloser, string, *rerr.RepositoryError)
|
||||
Put(ctx context.Context, repo, tag, digest string, mf *model.RepoSimpleManifest) error
|
||||
Delete(ctx context.Context, repo, tag string) error
|
||||
Tags(ctx context.Context, repo string, n, last int, prefix string) (*model.Tag, *rerr.RepositoryError)
|
||||
Catalog(ctx context.Context, n, last int, prefix string) (*model.Catalog, *rerr.RepositoryError)
|
||||
Referrers(ctx context.Context, repo, target string) (*model.IndexManifest, *rerr.RepositoryError)
|
||||
}
|
||||
Reference in New Issue
Block a user