stubs

package
v5.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package stubs contains trivial stubs for parts of private.ImageDestination. It can be used from internal/wrapper, so it should not drag in any extra dependencies. Compare with imagedestination/impl, which might require non-trivial implementation work.

There are two kinds of stubs:

First, there are pure stubs, like ImplementsPutBlobPartial. Those can just be included in an imageDestination implementation:

type yourDestination struct {
	stubs.ImplementsPutBlobPartial
	…
}

Second, there are stubs with a constructor, like NoPutBlobPartialInitialize. The Initialize marker means that a constructor must be called:

type yourDestination struct {
	stubs.NoPutBlobPartialInitialize
	…
}

dest := &yourDestination{
	…
	NoPutBlobPartialInitialize: stubs.NoPutBlobPartial(ref),
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlwaysSupportsSignatures

type AlwaysSupportsSignatures struct{}

SupportsSignatures implements SupportsSignatures() that returns nil. Note that it might be even more useful to return a value dynamically detected based on

func (AlwaysSupportsSignatures) SupportsSignatures

func (stub AlwaysSupportsSignatures) SupportsSignatures(ctx context.Context) error

SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures. Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.

type ImplementsPutBlobPartial

type ImplementsPutBlobPartial struct{}

ImplementsPutBlobPartial implements SupportsPutBlobPartial() that returns true.

func (ImplementsPutBlobPartial) SupportsPutBlobPartial

func (stub ImplementsPutBlobPartial) SupportsPutBlobPartial() bool

SupportsPutBlobPartial returns true if PutBlobPartial is supported.

type NoPutBlobPartialInitialize

type NoPutBlobPartialInitialize struct {
	// contains filtered or unexported fields
}

NoPutBlobPartialInitialize implements parts of private.ImageDestination for transports that don’t support PutBlobPartial(). See NoPutBlobPartial() below.

func NoPutBlobPartial

func NoPutBlobPartial(ref types.ImageReference) NoPutBlobPartialInitialize

NoPutBlobPartial creates a NoPutBlobPartialInitialize for ref.

func NoPutBlobPartialRaw

func NoPutBlobPartialRaw(transportName string) NoPutBlobPartialInitialize

NoPutBlobPartialRaw is the same thing as NoPutBlobPartial, but it can be used in situations where no ImageReference is available.

func (NoPutBlobPartialInitialize) PutBlobPartial

PutBlobPartial attempts to create a blob using the data that is already present at the destination. chunkAccessor is accessed in a non-sequential way to retrieve the missing chunks. It is available only if SupportsPutBlobPartial(). Even if SupportsPutBlobPartial() returns true, the call can fail, in which case the caller should fall back to PutBlobWithOptions.

func (NoPutBlobPartialInitialize) SupportsPutBlobPartial

func (stub NoPutBlobPartialInitialize) SupportsPutBlobPartial() bool

SupportsPutBlobPartial returns true if PutBlobPartial is supported.

type NoSignaturesInitialize

type NoSignaturesInitialize struct {
	// contains filtered or unexported fields
}

NoSignaturesInitialize implements parts of private.ImageDestination for transports that don’t support storing signatures. See NoSignatures() below.

func NoSignatures

func NoSignatures(message string) NoSignaturesInitialize

NoSignatures creates a NoSignaturesInitialize, failing with message.

func (NoSignaturesInitialize) PutSignaturesWithFormat

func (stub NoSignaturesInitialize) PutSignaturesWithFormat(ctx context.Context, signatures []signature.Signature, instanceDigest *digest.Digest) error

PutSignaturesWithFormat writes a set of signatures to the destination. If instanceDigest is not nil, it contains a digest of the specific manifest instance to write or overwrite the signatures for (when the primary manifest is a manifest list); this should always be nil if the primary manifest is not a manifest list. MUST be called after PutManifest (signatures may reference manifest contents).

func (NoSignaturesInitialize) SupportsSignatures

func (stub NoSignaturesInitialize) SupportsSignatures(ctx context.Context) error

SupportsSignatures returns an error (to be displayed to the user) if the destination certainly can't store signatures. Note: It is still possible for PutSignatures to fail if SupportsSignatures returns nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL