Documentation
¶
Index ¶
- Variables
- func DefaultRetryBackoff() remote.Backoff
- type Client
- type ManifestResult
- type Platform
- type PlatformManifest
- type RegistryClient
- func (c *RegistryClient) Exists(ctx context.Context, imageRef string) (bool, error)
- func (c *RegistryClient) GetImage(ctx context.Context, imageRef string, platform *Platform) (v1.Image, error)
- func (c *RegistryClient) Inspect(ctx context.Context, imageRef string, platform *Platform) (*ManifestResult, error)
- func (c *RegistryClient) PushImage(ctx context.Context, ref string, img v1.Image) error
- func (c *RegistryClient) PushIndex(ctx context.Context, ref string, idx v1.ImageIndex) error
- func (c *RegistryClient) WriteLayer(ctx context.Context, opts WriteLayerOptions) error
- type RetryCallback
- type RetryConfig
- type RetryEvent
- type WriteLayerOptions
Constants ¶
This section is empty.
Variables ¶
var NotFoundError = errors.New("image reference not found")
Functions ¶
func DefaultRetryBackoff ¶
DefaultRetryBackoff returns the default retry backoff configuration for weight pushes. It retries 5 times with exponential backoff starting at 2 seconds.
Types ¶
type Client ¶
type Client interface {
// Read methods
Inspect(ctx context.Context, imageRef string, platform *Platform) (*ManifestResult, error)
GetImage(ctx context.Context, imageRef string, platform *Platform) (v1.Image, error)
Exists(ctx context.Context, imageRef string) (bool, error)
// Write methods for OCI index support
PushImage(ctx context.Context, ref string, img v1.Image) error
PushIndex(ctx context.Context, ref string, idx v1.ImageIndex) error
// WriteLayer pushes a single layer (blob) to a repository with retry and optional progress reporting.
// This method handles transient failures automatically with exponential backoff.
// Use WriteLayerOptions to configure progress reporting and retry callbacks.
WriteLayer(ctx context.Context, opts WriteLayerOptions) error
}
func NewRegistryClient ¶ added in v0.15.3
func NewRegistryClient() Client
type ManifestResult ¶
type ManifestResult struct {
SchemaVersion int64
MediaType string
Manifests []PlatformManifest
Layers []string
Config string
Labels map[string]string
}
func (*ManifestResult) IsIndex ¶
func (m *ManifestResult) IsIndex() bool
func (*ManifestResult) IsSinglePlatform ¶
func (m *ManifestResult) IsSinglePlatform() bool
type PlatformManifest ¶
type RegistryClient ¶ added in v0.15.3
type RegistryClient struct{}
func (*RegistryClient) Inspect ¶ added in v0.15.3
func (c *RegistryClient) Inspect(ctx context.Context, imageRef string, platform *Platform) (*ManifestResult, error)
func (*RegistryClient) PushIndex ¶
func (c *RegistryClient) PushIndex(ctx context.Context, ref string, idx v1.ImageIndex) error
PushIndex pushes an OCI Image Index to a registry.
func (*RegistryClient) WriteLayer ¶
func (c *RegistryClient) WriteLayer(ctx context.Context, opts WriteLayerOptions) error
WriteLayer pushes a single layer with retry and optional progress reporting. This implements retry at the application level with callbacks for CLI feedback. Unlike the standard remote.WriteLayer, this implementation performs multipart uploads using Content-Range headers to upload the blob in chunks.
type RetryCallback ¶
type RetryCallback func(event RetryEvent) bool
RetryCallback is called when a retry occurs. Return false to abort retrying.
type RetryConfig ¶
type RetryConfig struct {
// Backoff configures the exponential backoff for retries.
// If nil, the default backoff from go-containerregistry is used (3 attempts, 1s initial, 3x factor).
Backoff *remote.Backoff
// OnRetry is called when a retry occurs. If nil, no callback is invoked.
// The callback receives information about the retry attempt.
OnRetry RetryCallback
}
RetryConfig configures retry behavior for registry operations.
type RetryEvent ¶
type RetryEvent struct {
// Attempt is the current retry attempt number (1-indexed).
Attempt int
// MaxAttempts is the maximum number of retry attempts.
MaxAttempts int
// Err is the error that caused the retry.
Err error
// NextRetryIn is the duration until the next retry attempt.
NextRetryIn time.Duration
}
RetryEvent contains information about a retry attempt.
type WriteLayerOptions ¶
type WriteLayerOptions struct {
// Repo is the repository to push to.
Repo string
// Layer is the layer to push.
Layer v1.Layer
// ProgressCh receives progress updates. Use a buffered channel to avoid deadlocks.
// If nil, no progress updates are sent.
ProgressCh chan<- v1.Update
// Retry configures retry behavior. If nil, default retry behavior is used
// (5 attempts with exponential backoff starting at 2 seconds).
Retry *RetryConfig
}
WriteLayerOptions configures the WriteLayer operation.