bufwire

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: 32 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 FileLister

type FileLister interface {
	// ListFiles lists the files.
	//
	// If includeImports is set, the ref is built, which can result in FileAnnotations.
	// There is no defined returned sorting order. If you need the FileInfos to
	// be sorted, do so with bufmoduleref.SortFileInfos or bufmoduleref.SortFileInfosByExternalPath.
	ListFiles(
		ctx context.Context,
		container app.EnvStdinContainer,
		ref buffetch.Ref,
		configOverride string,
		includeImports bool,
	) ([]bufmoduleref.FileInfo, []bufanalysis.FileAnnotation, error)
}

FileLister lists files.

func NewFileLister

func NewFileLister(
	logger *zap.Logger,
	storageosProvider storageos.Provider,
	fetchReader buffetch.Reader,
	moduleBucketBuilder bufmodulebuild.ModuleBucketBuilder,
	imageBuilder bufimagebuild.Builder,
) FileLister

NewFileLister returns a new FileLister.

type ImageConfig

type ImageConfig interface {
	Image() bufimage.Image
	Config() *bufconfig.Config
}

ImageConfig is an image and configuration.

type ImageConfigReader

type ImageConfigReader interface {
	// GetImageConfigs gets the ImageConfig for the fetch value.
	//
	// If externalDirOrFilePaths is empty, this builds all files under Buf control.
	GetImageConfigs(
		ctx context.Context,
		container app.EnvStdinContainer,
		ref buffetch.Ref,
		configOverride string,
		externalDirOrFilePaths []string,
		externalExcludeDirOrFilePaths []string,
		externalDirOrFilePathsAllowNotExist bool,
		excludeSourceCodeInfo bool,
	) ([]ImageConfig, []bufanalysis.FileAnnotation, error)
}

ImageConfigReader is an ImageConfig reader.

func NewImageConfigReader

func NewImageConfigReader(
	logger *zap.Logger,
	storageosProvider storageos.Provider,
	fetchReader buffetch.Reader,
	moduleBucketBuilder bufmodulebuild.ModuleBucketBuilder,
	imageBuilder bufimagebuild.Builder,
) ImageConfigReader

NewImageConfigReader returns a new ImageConfigReader.

type ImageReader

type ImageReader interface {
	// GetImage reads the image from the value.
	GetImage(
		ctx context.Context,
		container app.EnvStdinContainer,
		imageRef buffetch.ImageRef,
		externalDirOrFilePaths []string,
		externalExcludeDirOrFilePaths []string,
		externalDirOrFilePathsAllowNotExist bool,
		excludeSourceCodeInfo bool,
	) (bufimage.Image, error)
}

ImageReader is an image reader.

func NewImageReader

func NewImageReader(
	logger *zap.Logger,
	fetchReader buffetch.ImageReader,
) 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,
		imageRef buffetch.ImageRef,
		image bufimage.Image,
		asFileDescriptorSet bool,
		excludeImports bool,
	) error
}

ImageWriter is an image writer.

func NewImageWriter

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

NewImageWriter returns a new ImageWriter.

type ModuleConfig

type ModuleConfig interface {
	Module() bufmodule.Module
	Config() *bufconfig.Config
}

ModuleConfig is a Module and configuration.

type ModuleConfigReader

type ModuleConfigReader interface {
	// GetModuleConfigSet gets the ModuleConfigSet for the fetch value.
	//
	// If externalDirOrFilePaths is empty, this builds all files under Buf control.
	//
	// Note that as opposed to ModuleReader, this will return Modules for either
	// a source or module reference, not just a module reference.
	GetModuleConfigSet(
		ctx context.Context,
		container app.EnvStdinContainer,
		sourceOrModuleRef buffetch.SourceOrModuleRef,
		configOverride string,
		externalDirOrFilePaths []string,
		externalExcludeDirOrFilePaths []string,
		externalDirOrFilePathsAllowNotExist bool,
	) (ModuleConfigSet, error)
}

ModuleConfigReader is a ModuleConfig reader.

func NewModuleConfigReader

func NewModuleConfigReader(
	logger *zap.Logger,
	storageosProvider storageos.Provider,
	fetchReader buffetch.Reader,
	moduleBucketBuilder bufmodulebuild.ModuleBucketBuilder,
) ModuleConfigReader

NewModuleConfigReader returns a new ModuleConfigReader

type ModuleConfigSet

type ModuleConfigSet interface {
	ModuleConfigs() []ModuleConfig
	// Optional. May be nil.
	Workspace() bufmodule.Workspace
}

ModuleConfigSet is a set of ModuleConfigs with a potentially associated Workspace.

type ProtoEncodingReader

type ProtoEncodingReader interface {
	// GetMessage reads the message by the messageRef.
	//
	// Currently, this support bin and JSON format.
	GetMessage(
		ctx context.Context,
		container app.EnvStdinContainer,
		image bufimage.Image,
		typeName string,
		messageRef bufconvert.MessageEncodingRef,
	) (proto.Message, error)
}

ProtoEncodingReader is a reader that reads a protobuf message in different encoding.

func NewProtoEncodingReader

func NewProtoEncodingReader(
	logger *zap.Logger,
) ProtoEncodingReader

NewProtoEncodingReader returns a new ProtoEncodingReader.

type ProtoEncodingWriter

type ProtoEncodingWriter interface {
	// PutMessage writes the message to the path, which can be
	// a path in file system, or stdout represented by "-".
	//
	// Currently, this support bin and JSON format.
	PutMessage(
		ctx context.Context,
		container app.EnvStdoutContainer,
		image bufimage.Image,
		message proto.Message,
		messageRef bufconvert.MessageEncodingRef,
	) error
}

ProtoEncodingWriter is a writer that writes a protobuf message in different encoding.

func NewProtoEncodingWriter

func NewProtoEncodingWriter(
	logger *zap.Logger,
) ProtoEncodingWriter

NewProtoEncodingWriter returns a new ProtoEncodingWriter.

Jump to

Keyboard shortcuts

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