Documentation
¶
Index ¶
- Variables
- func GetInputConfigForString(ctx context.Context, refParser RefParser, value string) (bufconfig.InputConfig, error)
- type BucketExtender
- type DirOrProtoFileRef
- type DirOrProtoFileRefParser
- type DirReader
- type DirRef
- type DirRefParser
- type GetReadBucketCloserOption
- func GetReadBucketCloserWithCopyToInMemory() GetReadBucketCloserOption
- func GetReadBucketCloserWithNoSearch() GetReadBucketCloserOption
- func GetReadBucketCloserWithTargetExcludePaths(targetExcludePaths []string) GetReadBucketCloserOption
- func GetReadBucketCloserWithTargetPaths(targetPaths []string) GetReadBucketCloserOption
- type GetReadWriteBucketOption
- type MessageEncoding
- type MessageReader
- type MessageRef
- type MessageRefParser
- type MessageRefParserOption
- type ModuleFetcher
- type ModuleRef
- type ModuleRefParser
- type ProtoFileRef
- type ProtoFileWriter
- type ReadBucketCloser
- type ReadWriteBucket
- type Reader
- type Ref
- type RefParser
- type SourceOrModuleRef
- type SourceOrModuleRefParser
- type SourceReader
- type SourceRef
- type SourceRefParser
- type Writer
Constants ¶
This section is empty.
Variables ¶
var ( // MessageFormatsString is the string representation of all message formats. // // This does not include deprecated formats. MessageFormatsString = stringutil.SliceToString(messageFormatsNotDeprecated) // 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) // DirOrProtoFileFormatsString is the string representation of all dir or proto file formats. // // This does not include deprecated formats. DirOrProtoFileFormatsString = stringutil.SliceToString(dirOrProtoFileFormats) // AllFormatsString is the string representation of all formats. // // This does not include deprecated formats. AllFormatsString = stringutil.SliceToString(allFormatsNotDeprecated) // ErrModuleFormatDetectedForDirOrProtoFileRef is the error returned if a module is the // detected format in the DirOrProtoFileRefParser. We have a special heuristic to determine // if a path is a module or directory, and if a user specifies a suspected module, we want to error. ErrModuleFormatDetectedForDirOrProtoFileRef = errors.New("module format detected when parsing dir or proto file refs") )
Functions ¶
func GetInputConfigForString ¶ added in v1.32.0
func GetInputConfigForString( ctx context.Context, refParser RefParser, value string, ) (bufconfig.InputConfig, error)
GetInputConfigForString returns the input config for the input string.
Types ¶
type BucketExtender ¶ added in v1.32.0
type BucketExtender internal.BucketExtender
BucketExtender matches the internal type.
type DirOrProtoFileRef ¶ added in v1.32.0
type DirOrProtoFileRef interface {
// contains filtered or unexported methods
}
DirOrProtoFileRef is a directory or proto file reference.
type DirOrProtoFileRefParser ¶ added in v1.32.0
type DirOrProtoFileRefParser interface {
// GetDirOrProtoFileRef gets the reference for the value.
//
// The value cannot be stdin, stdout, or stderr.
GetDirOrProtoFileRef(ctx context.Context, value string) (DirOrProtoFileRef, error)
// GetDirOrProtoFileRefForInputConfig gets the reference for the InputConfig.
//
// The input cannot be stdin, stdout, or stderr.
GetDirOrProtoFileRefForInputConfig(
ctx context.Context,
inputConfig bufconfig.InputConfig,
) (DirOrProtoFileRef, error)
}
DirOrProtoFileRefParser is a dir or proto file ref parser for Buf.
func NewDirOrProtoFileRefParser ¶ added in v1.32.0
func NewDirOrProtoFileRefParser(logger *slog.Logger) DirOrProtoFileRefParser
NewDirOrProtoFileRefParser returns a new RefParser for dirs only.
type DirReader ¶ added in v1.32.0
type DirReader interface {
// GetDirReadWriteBucket gets the dir bucket.
GetDirReadWriteBucket(
ctx context.Context,
container app.EnvStdinContainer,
dirRef DirRef,
options ...GetReadWriteBucketOption,
) (ReadWriteBucket, buftarget.BucketTargeting, error)
}
DirReader is a dir reader.
type DirRef ¶ added in v1.32.0
type DirRef interface {
SourceRef
DirOrProtoFileRef
DirPath() string
// contains filtered or unexported methods
}
DirRef is a dir bucket reference.
type DirRefParser ¶ added in v1.32.0
type DirRefParser interface {
// GetDirRef gets the reference for the value.
//
// The value cannot be stdin, stdout, or stderr.
GetDirRef(ctx context.Context, value string) (DirRef, error)
// GetDirRefForInputConfig gets the reference for the InputConfig.
//
// The input cannot be stdin, stdout, or stderr.
GetDirRefForInputConfig(
ctx context.Context,
inputConfig bufconfig.InputConfig,
) (DirRef, error)
}
DirRefParser is a dir ref parser for Buf.
func NewDirRefParser ¶ added in v1.32.0
func NewDirRefParser(logger *slog.Logger) DirRefParser
NewDirRefParser returns a new RefParser for dirs only.
type GetReadBucketCloserOption ¶ added in v1.32.0
type GetReadBucketCloserOption func(*getReadBucketCloserOptions)
GetReadBucketCloserOption is an option for a GetSourceReadBucketCloser call.
func GetReadBucketCloserWithCopyToInMemory ¶ added in v1.32.0
func GetReadBucketCloserWithCopyToInMemory() GetReadBucketCloserOption
GetReadBucketCloserWithCopyToInMemory says to copy the returned ReadBucketCloser to an in-memory ReadBucketCloser. This can be a performance optimization at the expense of memory.
func GetReadBucketCloserWithNoSearch ¶ added in v1.32.0
func GetReadBucketCloserWithNoSearch() GetReadBucketCloserOption
GetReadBucketCloserWithNoSearch says to not search for buf.work.yamls or buf.yamls, instead just returning a bucket for the direct SourceRef or DirRef given.
This is used for when the --config flag is specified.
func GetReadBucketCloserWithTargetExcludePaths ¶ added in v1.32.0
func GetReadBucketCloserWithTargetExcludePaths(targetExcludePaths []string) GetReadBucketCloserOption
GetReadBucketCloserWithTargetExcludePaths sets the target exclude paths for bucket targeting information returned with the bucket.
func GetReadBucketCloserWithTargetPaths ¶ added in v1.32.0
func GetReadBucketCloserWithTargetPaths(targetPaths []string) GetReadBucketCloserOption
GetReadBucketCloserWithTargetPaths sets the targets paths for bucket targeting information returned with the bucket.
type GetReadWriteBucketOption ¶ added in v1.32.0
type GetReadWriteBucketOption func(*getReadWriteBucketOptions)
GetReadWriteBucketOption is an option for a GetDirReadWriteBucket call.
func GetReadWriteBucketWithNoSearch ¶ added in v1.32.0
func GetReadWriteBucketWithNoSearch() GetReadWriteBucketOption
GetReadWriteBucketWithNoSearch says to not search for buf.work.yamls or buf.yamls, instead just returning a bucket for the direct SourceRef or DirRef given.
This is used for when the --config flag is specified.
func GetReadWriteBucketWithTargetExcludePaths ¶ added in v1.32.0
func GetReadWriteBucketWithTargetExcludePaths(targetExcludePaths []string) GetReadWriteBucketOption
GetReadWriteBucketWithTargetExcludePaths sets the target exclude paths for the bucket targeting information returned with the bucket.
func GetReadWriteBucketWithTargetPaths ¶ added in v1.32.0
func GetReadWriteBucketWithTargetPaths(targetPaths []string) GetReadWriteBucketOption
GetReadWriteBucketWithTargetPaths sets the target paths for the bucket targeting information returned with the bucket.
type MessageEncoding ¶ added in v1.29.0
type MessageEncoding int
MessageEncoding is the encoding of the message.
const ( // MessageEncodingBinpb is the binary message encoding. MessageEncodingBinpb MessageEncoding = iota + 1 // MessageEncodingJSON is the JSON message encoding. MessageEncodingJSON // MessageEncodingTxtpb is the text protobuf message encoding. MessageEncodingTxtpb // MessageEncodingYAML is the YAML message encoding. MessageEncodingYAML )
type MessageReader ¶ added in v1.29.0
type MessageReader interface {
// GetMessageFile gets the message file.
//
// The returned file will be uncompressed.
GetMessageFile(
ctx context.Context,
container app.EnvStdinContainer,
messageRef MessageRef,
) (io.ReadCloser, error)
}
MessageReader is a message reader.
func NewMessageReader ¶ added in v1.29.0
func NewMessageReader( logger *slog.Logger, storageosProvider storageos.Provider, httpClient *http.Client, httpAuthenticator httpauth.Authenticator, gitCloner git.Cloner, ) MessageReader
NewMessageReader returns a new MessageReader.
type MessageRef ¶ added in v1.29.0
type MessageRef interface {
Ref
MessageEncoding() MessageEncoding
// Path returns the path of the file.
//
// May be used for items such as YAML unmarshalling errors.
Path() string
// UseProtoNames only applies for MessageEncodingYAML at this time.
UseProtoNames() bool
// UseEnumNumbers only applies for MessageEncodingYAML at this time.
UseEnumNumbers() bool
IsNull() bool
// contains filtered or unexported methods
}
MessageRef is a message file reference.
type MessageRefParser ¶ added in v1.29.0
type MessageRefParser interface {
// GetMessageRef gets the reference for the message file.
GetMessageRef(ctx context.Context, value string) (MessageRef, error)
// GetMessageRefForInputConfig gets the reference for the message file.
GetMessageRefForInputConfig(
ctx context.Context,
inputConfig bufconfig.InputConfig,
) (MessageRef, error)
}
MessageRefParser is an message ref parser for Buf.
func NewMessageRefParser ¶ added in v1.29.0
func NewMessageRefParser(logger *slog.Logger, options ...MessageRefParserOption) MessageRefParser
NewMessageRefParser returns a new RefParser for messages only.
type MessageRefParserOption ¶ added in v1.29.0
type MessageRefParserOption func(*messageRefParserOptions)
MessageRefParserOption is an option for a new MessageRefParser.
func MessageRefParserWithDefaultMessageEncoding ¶ added in v1.29.0
func MessageRefParserWithDefaultMessageEncoding(defaultMessageEncoding MessageEncoding) MessageRefParserOption
MessageRefParserWithDefaultMessageEncoding says to use the default MessageEncoding.
The default default is MessageEncodingBinpb.
type ModuleFetcher ¶
type ModuleFetcher interface {
// GetModuleKey gets the ModuleKey.
// Unresolved ModuleRef's are automatically resolved.
GetModuleKey(
ctx context.Context,
container app.EnvStdinContainer,
moduleRef ModuleRef,
) (bufmodule.ModuleKey, error)
}
ModuleFetcher is a module fetcher.
func NewModuleFetcher ¶
func NewModuleFetcher( logger *slog.Logger, storageosProvider storageos.Provider, moduleKeyProvider bufmodule.ModuleKeyProvider, ) 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 *slog.Logger) ModuleRefParser
NewModuleRefParser returns a new RefParser for modules only.
type ProtoFileRef ¶ added in v1.0.0
type ProtoFileRef interface {
SourceRef
DirOrProtoFileRef
ProtoFilePath() string
// IsDevPath returns true if the FileScheme is Stdio, Stdout, Stdin, or Null.
IsDevPath() bool
IncludePackageFiles() bool
// contains filtered or unexported methods
}
ProtoFileRef is a proto file reference.
type ProtoFileWriter ¶ added in v1.32.0
type ProtoFileWriter interface {
// PutProtoFile puts the proto file.
PutProtoFile(
ctx context.Context,
container app.EnvStdoutContainer,
protoFileRef ProtoFileRef,
) (io.WriteCloser, error)
}
ProtoFileWriter is a writer of proto files.
func NewProtoFileWriter ¶ added in v1.32.0
func NewProtoFileWriter( logger *slog.Logger, ) ProtoFileWriter
NewProtoFileWriter returns a new ProtoFileWriter.
type ReadBucketCloser ¶
type ReadBucketCloser internal.ReadBucketCloser
ReadBucketCloser matches the internal type.
type ReadWriteBucket ¶ added in v1.32.0
type ReadWriteBucket internal.ReadWriteBucket
ReadWriteBucket matches the internal type.
type Reader ¶
type Reader interface {
MessageReader
SourceReader
DirReader
ModuleFetcher
}
Reader is a reader for Buf.
type Ref ¶
type Ref interface {
// contains filtered or unexported methods
}
Ref is an message file or source bucket reference.
type RefParser ¶
type RefParser interface {
MessageRefParser
SourceRefParser
DirRefParser
SourceOrModuleRefParser
// GetRef gets the reference for the message file, source bucket, or module.
// TODO FUTURE: should this be renamed to GetRefForString?
GetRef(ctx context.Context, value string) (Ref, error)
// GetRefForInputConfig gets the reference for the message file, source bucket, or module.
GetRefForInputConfig(ctx context.Context, inputConfig bufconfig.InputConfig) (Ref, error)
}
RefParser is a ref parser for Buf.
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 message file or source bucket.
GetSourceOrModuleRef(ctx context.Context, value string) (SourceOrModuleRef, error)
// GetSourceOrModuleRefForInputConfig gets the reference for the message file or source bucket.
GetSourceOrModuleRefForInputConfig(
ctx context.Context,
inputConfig bufconfig.InputConfig,
) (SourceOrModuleRef, error)
}
SourceOrModuleRefParser is a source or module ref parser for Buf.
func NewSourceOrModuleRefParser ¶
func NewSourceOrModuleRefParser(logger *slog.Logger) SourceOrModuleRefParser
NewSourceOrModuleRefParser returns a new RefParser for sources or modules only.
This defaults to dir or module.
type SourceReader ¶
type SourceReader interface {
// GetSourceReadBucketCloser gets the source bucket.
GetSourceReadBucketCloser(
ctx context.Context,
container app.EnvStdinContainer,
sourceRef SourceRef,
options ...GetReadBucketCloserOption,
) (ReadBucketCloser, buftarget.BucketTargeting, error)
}
SourceReader is a source reader.
func NewSourceReader ¶
func NewSourceReader( logger *slog.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)
// GetSourceRefForInputConfig gets the reference for the source file.
GetSourceRefForInputConfig(
ctx context.Context,
inputConfig bufconfig.InputConfig,
) (SourceRef, error)
}
SourceRefParser is a source ref parser for Buf.
func NewSourceRefParser ¶
func NewSourceRefParser(logger *slog.Logger) SourceRefParser
NewSourceRefParser returns a new RefParser for sources only.
This defaults to dir.
type Writer ¶
type Writer interface {
// PutMessageFile puts the message file.
PutMessageFile(
ctx context.Context,
container app.EnvStdoutContainer,
messageRef MessageRef,
) (io.WriteCloser, error)
}
Writer is a writer for Buf.