bufwire

package
v0.20.5 Latest Latest
Warning

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

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

Documentation

Overview

Package bufwire wires everything together.

TODO: This package should be split up into individual functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env interface {
	Image() bufcore.Image
	Config() *bufconfig.Config
}

Env is an environment.

type EnvReader

type EnvReader interface {
	// GetEnv gets an environment for the fetch value.
	//
	// If externalFilePaths is empty, this builds all files under Buf control.
	GetEnv(
		ctx context.Context,
		container app.EnvStdinContainer,
		value string,
		configOverride string,
		externalFilePaths []string,
		externalFileFilePathsAllowNotExist bool,
		excludeSourceCodeInfo bool,
	) (Env, []bufanalysis.FileAnnotation, error)
	// GetImageEnv is the same as GetEnv but only allows image values and never builds.
	GetImageEnv(
		ctx context.Context,
		container app.EnvStdinContainer,
		value string,
		configOverride string,
		externalFilePaths []string,
		externalFileFilePathsAllowNotExist bool,
		excludeSourceCodeInfo bool,
	) (Env, error)
	// GetSourceEnv is the same as GetEnv but only allows source values and always builds.
	GetSourceEnv(
		ctx context.Context,
		container app.EnvStdinContainer,
		value string,
		configOverride string,
		externalFilePaths []string,
		externalFileFilePathsAllowNotExist bool,
		excludeSourceCodeInfo bool,
	) (Env, []bufanalysis.FileAnnotation, error)
	// ListFiles lists the files.
	ListFiles(
		ctx context.Context,
		container app.EnvStdinContainer,
		value string,
		configOverride string,
	) ([]bufcore.FileInfo, error)
	// GetConfig gets the config.
	GetConfig(
		ctx context.Context,
		configOverride string,
	) (*bufconfig.Config, error)
}

EnvReader is an environment reader.

func NewEnvReader

func NewEnvReader(
	logger *zap.Logger,
	fetchRefParser buffetch.RefParser,
	fetchReader buffetch.Reader,
	configProvider bufconfig.Provider,
	modBucketBuilder bufmod.BucketBuilder,
	buildBuilder bufbuild.Builder,
	valueFlagName string,
	configOverrideFlagName string,
) EnvReader

NewEnvReader returns a new EnvReader.

type ImageReader

type ImageReader interface {
	// GetImage reads the image from the value.
	GetImage(
		ctx context.Context,
		container app.EnvStdinContainer,
		value string,
		externalFilePaths []string,
		externalFileFilePathsAllowNotExist bool,
		excludeSourceCodeInfo bool,
	) (bufcore.Image, error)
}

ImageReader is an image reader.

func NewImageReader

func NewImageReader(
	logger *zap.Logger,
	fetchImageRefParser buffetch.ImageRefParser,
	fetchReader buffetch.Reader,
	valueFlagName string,
) ImageReader

NewImageReader returns a new ImageReader.

type ImageWriter

type ImageWriter interface {
	// PutImage writes the image to the value.
	//
	// The file must be an image format.
	// This is a no-np if value is the equivalent of /dev/null.
	PutImage(
		ctx context.Context,
		container app.EnvStdoutContainer,
		value string,
		image bufcore.Image,
		asFileDescriptorSet bool,
		excludeImports bool,
	) error
}

ImageWriter is an image writer.

func NewImageWriter

func NewImageWriter(
	logger *zap.Logger,
	fetchImageRefParser buffetch.ImageRefParser,
	fetchWriter buffetch.Writer,
) ImageWriter

NewImageWriter returns a new ImageWriter.

Jump to

Keyboard shortcuts

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