bufwire

package
v1.30.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 30 Imported by: 5

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,
		messageRef buffetch.MessageRef,
		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.MessageReader,
) 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,
		messageRef buffetch.MessageRef,
		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 added in v1.23.0

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 added in v1.1.0

type ProtoEncodingReader interface {
	// GetMessage reads the message by the messageRef.
	GetMessage(
		ctx context.Context,
		container app.EnvStdinContainer,
		image bufimage.Image,
		typeName string,
		messageRef buffetch.MessageRef,
	) (proto.Message, error)
}

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

func NewProtoEncodingReader added in v1.1.0

func NewProtoEncodingReader(
	logger *zap.Logger,
	fetchReader buffetch.MessageReader,
) ProtoEncodingReader

NewProtoEncodingReader returns a new ProtoEncodingReader.

type ProtoEncodingWriter added in v1.0.0

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 buffetch.MessageRef,
	) error
}

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

func NewProtoEncodingWriter added in v1.0.0

func NewProtoEncodingWriter(
	logger *zap.Logger,
	fetchWriter buffetch.Writer,
) ProtoEncodingWriter

NewProtoEncodingWriter returns a new ProtoEncodingWriter.

Jump to

Keyboard shortcuts

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