buffetch

package
v0.0.0-...-a078c60 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: Apache-2.0 Imports: 24 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)
	// SourceDirFormatsString is the string representation of all source directory formats.
	// This includes all of the formats in SourceFormatsString except the protofile format.
	//
	// This does not include deprecated formats.
	SourceDirFormatsString = stringutil.SliceToString(sourceDirFormatsNotDeprecated)
	// 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

type GetSourceBucketOption func(*getSourceBucketOptions)

GetSourceBucketOption is an option for GetSourceBucket.

func GetSourceBucketWithWorkspacesDisabled

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
	// ImageEncodingTxtpb is the text protobuf image encoding.
	ImageEncodingTxtpb
)

type ImageReader

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

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

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

func NewImageRefParser(logger *zap.Logger) ImageRefParser

NewImageRefParser returns a new RefParser for images only.

This defaults to binary.

type ModuleFetcher

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

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

NewModuleFetcher returns a new ModuleFetcher.

type ModuleRef

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

ModuleRef is a module reference.

type ModuleRefParser

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

func NewModuleRefParser(logger *zap.Logger) ModuleRefParser

NewModuleRefParser returns a new RefParser for modules only.

type PathResolver

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 ProtoFileRef

type ProtoFileRef interface {
	SourceRef
	IncludePackageFiles() bool
	// contains filtered or unexported methods
}

ProtoFileRef is a proto file reference.

type ReadBucketCloser

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 ReadBucketCloserWithTerminateFileProvider

type ReadBucketCloserWithTerminateFileProvider internal.ReadBucketCloserWithTerminateFileProvider

ReadBucketCloserWithTerminateFileProvider is a ReadBucketCloser with a TerminateFileProvider.

type ReadWriteBucketCloser

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

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

SourceOrModuleRef is a source bucket or module reference.

type SourceOrModuleRefParser

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

func NewSourceOrModuleRefParser(logger *zap.Logger) SourceOrModuleRefParser

NewSourceOrModuleRefParser returns a new RefParser for sources or modules only.

This defaults to dir or module.

type SourceReader

type SourceReader interface {
	// GetSourceBucket 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,
	) (ReadBucketCloserWithTerminateFileProvider, error)
}

SourceReader is a source reader.

func NewSourceReader

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

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

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