storage

package
v0.0.0-...-fb8dd36 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: BSD-3-Clause Imports: 13 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientImpl

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

ClientImpl implements the GCSClient interface.

func NewGCSClient

func NewGCSClient(ctx context.Context, client *http.Client, options GCSClientOptions) (*ClientImpl, error)

NewGCSClient creates a new instance of ClientImpl. The various output paths are set in GCSClientOptions.

func (*ClientImpl) GetImage

func (g *ClientImpl) GetImage(ctx context.Context, digest types.Digest) ([]byte, error)

GetImage downloads the bytes and returns them for the given image. It returns an error if the image is not found.

func (*ClientImpl) LoadKnownDigests

func (g *ClientImpl) LoadKnownDigests(ctx context.Context, w io.Writer) error

LoadKnownDigests fulfills the GCSClient interface. It does no caching of the result.

func (*ClientImpl) Options

func (g *ClientImpl) Options() GCSClientOptions

Options implements the GCSClient interface.

func (*ClientImpl) WriteKnownDigests

func (g *ClientImpl) WriteKnownDigests(ctx context.Context, digests types.DigestSlice) error

WriteKnownDigests fulfills the GCSClient interface.

type GCSClient

type GCSClient interface {
	// WriteKnownDigests writes the given list of digests to GCS as newline separated strings.
	WriteKnownDigests(ctx context.Context, digests types.DigestSlice) error

	// LoadKnownDigests loads the digests that have previously been written
	// to GS via WriteKnownDigests. The digests should be copied to the
	// provided writer 'w'.
	LoadKnownDigests(ctx context.Context, w io.Writer) error

	// GetImage returns the raw bytes of an image with the corresponding Digest.
	GetImage(ctx context.Context, digest types.Digest) ([]byte, error)

	// Options returns the options that were used to initialize the client
	Options() GCSClientOptions
}

GCSClient provides an abstraction around read/writes to Google storage.

type GCSClientOptions

type GCSClientOptions struct {
	// Bucket is the name of the GCS bucket we store to.
	Bucket string
	// KnownHashesGCSPath is the bucket and path for storing the list of known digests.
	KnownHashesGCSPath string

	// If DryRun is true, don't actually write the files (e.g. running locally)
	Dryrun bool
}

GCSClientOptions is used to define input parameters to the GCSClient.

Jump to

Keyboard shortcuts

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