stubs

package
v5.31.0 Latest Latest
Warning

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

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

Documentation

Overview

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

There are two kinds of stubs:

First, there are pure stubs, like ImplementsGetBlobAt. Those can just be included in an ImageSource

implementation:

type yourSource struct {
	stubs.ImplementsGetBlobAt
	…
}

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

type yourSource struct {
	stubs.NoGetBlobAtInitialize
	…
}

dest := &yourSource{
	…
	NoGetBlobAtInitialize: stubs.NoGetBlobAt(ref),
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImplementsGetBlobAt

type ImplementsGetBlobAt struct{}

ImplementsGetBlobAt implements SupportsGetBlobAt() that returns true.

func (ImplementsGetBlobAt) SupportsGetBlobAt

func (stub ImplementsGetBlobAt) SupportsGetBlobAt() bool

SupportsGetBlobAt() returns true if GetBlobAt (BlobChunkAccessor) is supported.

type NoGetBlobAtInitialize

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

NoGetBlobAtInitialize implements parts of private.ImageSource for transports that don’t support GetBlobAt(). See NoGetBlobAt() below.

func NoGetBlobAt

NoGetBlobAt() creates a NoGetBlobAtInitialize for ref.

func NoGetBlobAtRaw

func NoGetBlobAtRaw(transportName string) NoGetBlobAtInitialize

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

func (NoGetBlobAtInitialize) GetBlobAt

func (stub NoGetBlobAtInitialize) GetBlobAt(ctx context.Context, info types.BlobInfo, chunks []private.ImageSourceChunk) (chan io.ReadCloser, chan error, error)

GetBlobAt returns a sequential channel of readers that contain data for the requested blob chunks, and a channel that might get a single error value. The specified chunks must be not overlapping and sorted by their offset. The readers must be fully consumed, in the order they are returned, before blocking to read the next chunk. If the Length for the last chunk is set to math.MaxUint64, then it fully fetches the remaining data from the offset to the end of the blob.

func (NoGetBlobAtInitialize) SupportsGetBlobAt

func (stub NoGetBlobAtInitialize) SupportsGetBlobAt() bool

SupportsGetBlobAt() returns true if GetBlobAt (BlobChunkAccessor) is supported.

Jump to

Keyboard shortcuts

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