buffetch

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: Apache-2.0 Imports: 19 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)
	// ModuleFormatsString is the string representation of all module formats.
	//
	// Module formats are also source formats.
	//
	// This does not include deprecated formats.
	ModuleFormatsString = stringutil.SliceToString(moduleFormatsNotDeprecated)
	// SourceOrModuleFormatsString is the string representation of all source or module formats.
	//
	// This does not include deprecated formats.
	SourceOrModuleFormatsString = stringutil.SliceToString(sourceOrModuleFormatsNotDeprecated)
	// 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 GetSourceBucketOption added in v0.42.0

type GetSourceBucketOption func(*getSourceBucketOptions)

GetSourceBucketOption is an option for GetSourceBucket.

func GetSourceBucketWithWorkspacesDisabled added in v0.42.0

func GetSourceBucketWithWorkspacesDisabled() GetSourceBucketOption

GetSourceBucketWithWorkspacesDisabled disables workspace mode.

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 ImageReader added in v0.21.0

type ImageReader interface {
	// GetImageFile gets the image file.
	//
	// The returned file will be uncompressed.
	GetImageFile(
		ctx context.Context,
		container app.EnvStdinContainer,
		imageRef ImageRef,
	) (io.ReadCloser, error)
}

ImageReader is an image reader.

func NewImageReader added in v0.21.0

func NewImageReader(
	logger *zap.Logger,
	storageosProvider storageos.Provider,
	httpClient *http.Client,
	httpAuthenticator httpauth.Authenticator,
	gitCloner git.Cloner,
) ImageReader

NewImageReader returns a new ImageReader.

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 ModuleFetcher added in v0.25.0

type ModuleFetcher interface {
	// GetModule gets the module.
	// Unresolved ModuleRef's are automatically resolved.
	GetModule(
		ctx context.Context,
		container app.EnvStdinContainer,
		moduleRef ModuleRef,
	) (bufmodule.Module, error)
}

ModuleFetcher is a module fetcher.

func NewModuleFetcher added in v0.25.0

func NewModuleFetcher(
	logger *zap.Logger,
	storageosProvider storageos.Provider,
	moduleResolver bufmodule.ModuleResolver,
	moduleReader bufmodule.ModuleReader,
) ModuleFetcher

NewModuleFetcher returns a new ModuleFetcher.

type ModuleRef added in v0.21.0

type ModuleRef interface {
	SourceOrModuleRef
	// contains filtered or unexported methods
}

ModuleRef is a module reference.

type ModuleRefParser added in v0.21.0

type ModuleRefParser interface {
	// GetModuleRef gets the reference for the source file.
	//
	// A module is a special type of source with additional properties.
	GetModuleRef(ctx context.Context, value string) (ModuleRef, error)
}

ModuleRefParser is a source ref parser for Buf.

func NewModuleRefParser added in v0.21.0

func NewModuleRefParser(logger *zap.Logger) ModuleRefParser

NewModuleRefParser returns a new RefParser for modules only.

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 ReadBucketCloser added in v0.42.0

type ReadBucketCloser internal.ReadBucketCloser

ReadBucketCloser is a bucket returned from GetBucket. We need to surface the internal.ReadBucketCloser interface to other packages, so we use a type declaration to do so.

type ReadWriteBucketCloser added in v0.44.0

type ReadWriteBucketCloser internal.ReadWriteBucketCloser

ReadWriteBucketCloser is a bucket returned from GetBucket. We need to surface the internal.ReadWriteBucketCloser interface to other packages, so we use a type declaration to do so.

type Reader

type Reader interface {
	ImageReader
	SourceReader
	ModuleFetcher
}

Reader is a reader for Buf.

func NewReader

func NewReader(
	logger *zap.Logger,
	storageosProvider storageos.Provider,
	httpClient *http.Client,
	httpAuthenticator httpauth.Authenticator,
	gitCloner git.Cloner,
	moduleResolver bufmodule.ModuleResolver,
	moduleReader bufmodule.ModuleReader,
) 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
	SourceOrModuleRefParser

	// GetRef gets the reference for the image file, source bucket, or module.
	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.

This defaults to dir or module.

type SourceOrModuleRef added in v0.21.0

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

SourceOrModuleRef is a source bucket or module reference.

type SourceOrModuleRefParser added in v0.21.0

type SourceOrModuleRefParser interface {
	SourceRefParser
	ModuleRefParser

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

SourceOrModuleRefParser is a source or module ref parser for Buf.

func NewSourceOrModuleRefParser added in v0.21.0

func NewSourceOrModuleRefParser(logger *zap.Logger) SourceOrModuleRefParser

NewSourceOrModuleRefParser returns a new RefParser for sources or modules only.

This defaults to dir or module.

type SourceReader added in v0.21.0

type SourceReader interface {
	// GetSource gets the source bucket.
	//
	// The returned bucket will only have .proto and configuration files.
	// The returned bucket may be upgradeable to a ReadWriteBucketCloser.
	GetSourceBucket(
		ctx context.Context,
		container app.EnvStdinContainer,
		sourceRef SourceRef,
		options ...GetSourceBucketOption,
	) (ReadBucketCloser, error)
}

SourceReader is a source reader.

func NewSourceReader added in v0.21.0

func NewSourceReader(
	logger *zap.Logger,
	storageosProvider storageos.Provider,
	httpClient *http.Client,
	httpAuthenticator httpauth.Authenticator,
	gitCloner git.Cloner,
) SourceReader

NewSourceReader returns a new SourceReader.

type SourceRef

type SourceRef interface {
	SourceOrModuleRef
	// 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.

func NewSourceRefParser added in v0.21.0

func NewSourceRefParser(logger *zap.Logger) SourceRefParser

NewSourceRefParser returns a new RefParser for sources only.

This defaults to dir or module.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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