mirror of
https://github.com/regclient/regclient.git
synced 2025-07-29 09:01:11 +03:00
Refactoring the type package
I feel like I need to explain, this is all to move the descriptor package. The platform package could not use the predefined errors in types because of a circular dependency from descriptor. The most appropriate way to reorg this is to move descriptor out of the type package since it was more complex than a self contained type. When doing that, type aliases were needed to avoid breaking changes to existing users. Those aliases themselves caused circular dependency loops because of the media types and errors, so those were also pulled out to separate packages. All of the old values were aliased and deprecated, and to fix the linter, those deprecations were fixed by updating the imports... everywhere. Signed-off-by: Brandon Mitchell <git@bmitch.net>
This commit is contained in:
@ -7,7 +7,7 @@ import (
|
||||
|
||||
"github.com/opencontainers/go-digest"
|
||||
|
||||
"github.com/regclient/regclient/types"
|
||||
"github.com/regclient/regclient/types/descriptor"
|
||||
v1 "github.com/regclient/regclient/types/oci/v1"
|
||||
"github.com/regclient/regclient/types/ref"
|
||||
)
|
||||
@ -15,7 +15,7 @@ import (
|
||||
// Blob interface is used for returning blobs.
|
||||
type Blob interface {
|
||||
// GetDescriptor returns the descriptor associated with the blob.
|
||||
GetDescriptor() types.Descriptor
|
||||
GetDescriptor() descriptor.Descriptor
|
||||
// RawBody returns the raw content of the blob.
|
||||
RawBody() ([]byte, error)
|
||||
// RawHeaders returns the headers received from the registry.
|
||||
@ -38,7 +38,7 @@ type Blob interface {
|
||||
}
|
||||
|
||||
type blobConfig struct {
|
||||
desc types.Descriptor
|
||||
desc descriptor.Descriptor
|
||||
header http.Header
|
||||
image *v1.Image
|
||||
r ref.Ref
|
||||
@ -51,7 +51,7 @@ type blobConfig struct {
|
||||
type Opts func(*blobConfig)
|
||||
|
||||
// WithDesc specifies the descriptor associated with the blob.
|
||||
func WithDesc(d types.Descriptor) Opts {
|
||||
func WithDesc(d descriptor.Descriptor) Opts {
|
||||
return func(bc *blobConfig) {
|
||||
bc.desc = d
|
||||
}
|
||||
|
Reference in New Issue
Block a user