Documentation
¶
Index ¶
- Variables
- type GetSourceBucketOption
- type MessageEncoding
- type MessageReader
- type MessageRef
- type MessageRefParser
- type MessageRefParserOption
- type ModuleFetcher
- type ModuleRef
- type ModuleRefParser
- type PathResolver
- type ProtoFileRef
- type ReadBucketCloser
- type ReadBucketCloserWithTerminateFileProvider
- type ReadWriteBucketCloser
- 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) // 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 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 an message reader.
func NewMessageReader ¶ added in v1.29.0
func NewMessageReader( logger *zap.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 unmarshaling 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 an 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)
}
MessageRefParser is an message ref parser for Buf.
func NewMessageRefParser ¶ added in v1.29.0
func NewMessageRefParser(logger *zap.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 {
// 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 ¶ added in v1.0.0
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 ¶ added in v1.0.0
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 {
MessageReader
SourceReader
ModuleFetcher
}
Reader is a reader for Buf.
type Ref ¶
type Ref interface {
PathResolver
// contains filtered or unexported methods
}
Ref is an message file or source bucket reference.
type RefParser ¶
type RefParser interface {
MessageRefParser
SourceOrModuleRefParser
// GetRef gets the reference for the message file, source bucket, or module.
GetRef(ctx context.Context, value string) (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)
}
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 {
// PutMessageFile puts the message file.
PutMessageFile(
ctx context.Context,
container app.EnvStdoutContainer,
messageRef MessageRef,
) (io.WriteCloser, error)
}
Writer is a writer for Buf.