package out import ( "io" "time" ) // BlobStorage defines the contract for blob storage operations. type BlobStorage interface { // GetBlob retrieves a blob by digest. GetBlob(digest string) (io.ReadCloser, error) // GetBlobPath returns the filesystem path to a blob. GetBlobPath(digest string) (string, error) // PutBlob stores a blob with the given digest. PutBlob(digest string, data io.Reader, size int64) error // DeleteBlob removes a blob by digest. // Returns the size in bytes of the removed blob. DeleteBlob(digest string) (int64, error) // BlobExists checks if a blob exists. BlobExists(digest string) bool // ListBlobs returns all blob digests. ListBlobs() ([]string, error) // GetBlobModTime returns the last modification time for a blob. GetBlobModTime(digest string) (time.Time, error) // StartBlobUpload starts a new blob upload and returns the upload UUID. StartBlobUpload(name string) (string, error) // AppendBlobChunk appends data to an in-progress upload. AppendBlobChunk(name, uuid string, data io.Reader, contentLength, maxBlobSize int64) (int64, error) // GetBlobUpload returns a writer for the upload. GetBlobUpload(uuid string) (io.WriteCloser, error) // FinishBlobUpload completes an upload for the named repository and // records the repository/blob association. The upload must belong to // that repository; a mismatched repository reports ErrUploadNotFound. FinishBlobUpload(name, uuid, digest string) error // CancelBlobUpload cancels an in-progress upload owned by the named // repository. CancelBlobUpload(name, uuid string) error // BlobOwnedByRepository reports whether the repository completed an // upload of the digest. Ownership is never inferred from manifest // references, which a repository writer controls. BlobOwnedByRepository(name, digest string) (bool, error) // CleanupStaleUploads removes upload files older than maxAge. // Returns the number of uploads removed and total bytes reclaimed. CleanupStaleUploads(maxAge time.Duration) (removed int, bytesReclaimed int64, err error) } // ManifestStorage defines the contract for manifest storage operations. type ManifestStorage interface { // GetManifest retrieves a manifest by name and reference. // Returns the manifest data and content type. GetManifest(name, reference string) ([]byte, string, error) // PutManifest stores a manifest. PutManifest(name, reference, contentType string, data []byte) error // DeleteManifest removes a manifest. DeleteManifest(name, reference string) error // ListTags returns all tags for a repository. ListTags(name string) ([]string, error) // ListRepositories returns all repository names. ListRepositories() ([]string, error) // GetManifestModTime returns the manifest modification time. GetManifestModTime(name, reference string) (time.Time, error) }