buffetch

package
v0.20.4 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ImageFormatsString is the string representation of all image formats.
	//
	// This does not include deprecated formats.
	ImageFormatsString = stringutil.SliceToString(imageFormatsNotDeprecated)
	// SourceFormatsString is the string representation of all source formats.
	//
	// This does not include deprecated formats.
	SourceFormatsString = stringutil.SliceToString(sourceFormatsNotDeprecated)
	// AllFormatsString is the string representation of all formats.
	//
	// This does not include deprecated formats.
	AllFormatsString = stringutil.SliceToString(allFormatsNotDeprecated)
)

Functions

This section is empty.

Types

type ImageEncoding

type ImageEncoding int

ImageEncoding is the encoding of the image.

const (
	// ImageEncodingBin is the binary image encoding.
	ImageEncodingBin ImageEncoding = iota + 1
	// ImageEncodingJSON is the JSON image encoding.
	ImageEncodingJSON
)

type ImageRef

type ImageRef interface {
	Ref
	ImageEncoding() ImageEncoding
	IsNull() bool
	// contains filtered or unexported methods
}

ImageRef is an image file reference.

type ImageRefParser added in v0.19.0

type ImageRefParser interface {
	// GetImageRef gets the reference for the image file.
	GetImageRef(ctx context.Context, value string) (ImageRef, error)
}

ImageRefParser is an image ref parser for Buf.

func NewImageRefParser added in v0.19.0

func NewImageRefParser(logger *zap.Logger) ImageRefParser

NewImageRefParser returns a new RefParser for images only.

This defaults to binary.

type PathResolver added in v0.19.0

type PathResolver interface {
	// PathForExternalPath takes a path external to the asset and converts it to
	// a path that is relative to the asset.
	//
	// The returned path will be normalized and validated.
	//
	// Example:
	//   Directory: /foo/bar
	//   ExternalPath: /foo/bar/baz/bat.proto
	//   Path: baz/bat.proto
	//
	// Example:
	//   Directory: .
	//   ExternalPath: baz/bat.proto
	//   Path: baz/bat.proto
	PathForExternalPath(externalPath string) (string, error)
}

PathResolver resolves external paths to paths.

type Reader

type Reader interface {
	// GetImageFile gets the image file.
	//
	// The returned file will be uncompressed.
	GetImageFile(
		ctx context.Context,
		container app.EnvStdinContainer,
		imageRef ImageRef,
	) (io.ReadCloser, error)
	// GetSource gets the source bucket.
	//
	// The returned bucket will only have .proto and configuration files.
	GetSourceBucket(
		ctx context.Context,
		container app.EnvStdinContainer,
		sourceRef SourceRef,
	) (storage.ReadBucketCloser, error)
}

Reader is a reader for Buf.

func NewReader

func NewReader(
	logger *zap.Logger,
	httpClient *http.Client,
	httpAuthenticator httpauth.Authenticator,
	gitCloner git.Cloner,
) Reader

NewReader returns a new Reader.

type Ref

type Ref interface {
	PathResolver
	// contains filtered or unexported methods
}

Ref is an image file or source bucket reference.

type RefParser

type RefParser interface {
	ImageRefParser
	SourceRefParser

	// GetRef gets the reference for the image file or source bucket.
	GetRef(ctx context.Context, value string) (Ref, error)
}

RefParser is a ref parser for Buf.

func NewRefParser

func NewRefParser(logger *zap.Logger) RefParser

NewRefParser returns a new RefParser.

type SourceRef

type SourceRef interface {
	Ref
	// contains filtered or unexported methods
}

SourceRef is a source bucket reference.

type SourceRefParser added in v0.19.0

type SourceRefParser interface {
	// GetSourceRef gets the reference for the source file.
	GetSourceRef(ctx context.Context, value string) (SourceRef, error)
}

SourceRefParser is a source ref parser for Buf.

type Writer

type Writer interface {
	// PutImageFile puts the image file.
	PutImageFile(
		ctx context.Context,
		container app.EnvStdoutContainer,
		imageRef ImageRef,
	) (io.WriteCloser, error)
}

Writer is a writer for Buf.

func NewWriter

func NewWriter(
	logger *zap.Logger,
) Writer

NewWriter returns a new Writer.

Jump to

Keyboard shortcuts

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