buf: github.com/bufbuild/buf/internal/buf/buffetch Index | Files

package buffetch

import "github.com/bufbuild/buf/internal/buf/buffetch"

Index

Package Files

buffetch.go format.go image_ref.go module_ref.go reader.go ref_parser.go source_ref.go writer.go

Variables

var (
    // ImageFormatsString is the string representation of all image formats.
    //
    // This does not include deprecated formats.
    ImageFormatsString = stringutil.SliceToString(imageFormatsNotDeprecated)
    // 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)
)

type ImageEncoding Uses

type ImageEncoding int

ImageEncoding is the encoding of the image.

const (
    // ImageEncodingBin is the binary image encoding.
    ImageEncodingBin ImageEncoding = iota + 1
    // ImageEncodingJSON is the JSON image encoding.
    ImageEncodingJSON
)

type ImageReader Uses

type ImageReader interface {
    // GetImageFile gets the image file.
    //
    // The returned file will be uncompressed.
    GetImageFile(
        ctx context.Context,
        container app.EnvStdinContainer,
        imageRef ImageRef,
    ) (io.ReadCloser, error)
}

ImageReader is an image reader.

func NewImageReader Uses

func NewImageReader(
    logger *zap.Logger,
    httpClient *http.Client,
    httpAuthenticator httpauth.Authenticator,
    gitCloner git.Cloner,
) ImageReader

NewImageReader returns a new ImageReader.

type ImageRef Uses

type ImageRef interface {
    Ref
    ImageEncoding() ImageEncoding
    IsNull() bool
    // contains filtered or unexported methods
}

ImageRef is an image file reference.

type ImageRefParser Uses

type ImageRefParser interface {
    // GetImageRef gets the reference for the image file.
    GetImageRef(ctx context.Context, value string) (ImageRef, error)
}

ImageRefParser is an image ref parser for Buf.

func NewImageRefParser Uses

func NewImageRefParser(logger *zap.Logger) ImageRefParser

NewImageRefParser returns a new RefParser for images only.

This defaults to binary.

type ModuleFetcher Uses

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 Uses

func NewModuleFetcher(
    logger *zap.Logger,
    moduleResolver bufmodule.ModuleResolver,
    moduleReader bufmodule.ModuleReader,
) ModuleFetcher

NewModuleFetcher returns a new ModuleFetcher.

type ModuleRef Uses

type ModuleRef interface {
    SourceOrModuleRef
    // contains filtered or unexported methods
}

ModuleRef is a module reference.

type ModuleRefParser Uses

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 Uses

func NewModuleRefParser(logger *zap.Logger) ModuleRefParser

NewModuleRefParser returns a new RefParser for modules only.

type PathResolver Uses

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 Reader Uses

type Reader interface {
    ImageReader
    SourceReader
    ModuleFetcher
}

Reader is a reader for Buf.

func NewReader Uses

func NewReader(
    logger *zap.Logger,
    httpClient *http.Client,
    httpAuthenticator httpauth.Authenticator,
    gitCloner git.Cloner,
    moduleResolver bufmodule.ModuleResolver,
    moduleReader bufmodule.ModuleReader,
) Reader

NewReader returns a new Reader.

type Ref Uses

type Ref interface {
    PathResolver
    // contains filtered or unexported methods
}

Ref is an image file or source bucket reference.

type RefParser Uses

type RefParser interface {
    ImageRefParser
    SourceOrModuleRefParser

    // GetRef gets the reference for the image file, source bucket, or module.
    GetRef(ctx context.Context, value string) (Ref, error)
}

RefParser is a ref parser for Buf.

func NewRefParser Uses

func NewRefParser(logger *zap.Logger) RefParser

NewRefParser returns a new RefParser.

This defaults to dir or module.

type SourceOrModuleRef Uses

type SourceOrModuleRef interface {
    Ref
    // contains filtered or unexported methods
}

SourceOrModuleRef is a source bucket or module reference.

type SourceOrModuleRefParser Uses

type SourceOrModuleRefParser interface {
    SourceRefParser
    ModuleRefParser

    // GetSourceOrModuleRef gets the reference for the image file or source bucket.
    GetSourceOrModuleRef(ctx context.Context, value string) (SourceOrModuleRef, error)
}

SourceOrModuleRefParser is a source or module ref parser for Buf.

func NewSourceOrModuleRefParser Uses

func NewSourceOrModuleRefParser(logger *zap.Logger) SourceOrModuleRefParser

NewSourceOrModuleRefParser returns a new RefParser for sources or modules only.

This defaults to dir or module.

type SourceReader Uses

type SourceReader interface {
    // GetSource gets the source bucket.
    //
    // The returned bucket will only have .proto and configuration files.
    GetSourceBucket(
        ctx context.Context,
        container app.EnvStdinContainer,
        sourceRef SourceRef,
    ) (storage.ReadBucketCloser, error)
}

SourceReader is a source reader.

func NewSourceReader Uses

func NewSourceReader(
    logger *zap.Logger,
    httpClient *http.Client,
    httpAuthenticator httpauth.Authenticator,
    gitCloner git.Cloner,
) SourceReader

NewSourceReader returns a new SourceReader.

type SourceRef Uses

type SourceRef interface {
    SourceOrModuleRef
    // contains filtered or unexported methods
}

SourceRef is a source bucket reference.

type SourceRefParser Uses

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 Uses

func NewSourceRefParser(logger *zap.Logger) SourceRefParser

NewSourceRefParser returns a new RefParser for sources only.

This defaults to dir or module.

type Writer Uses

type Writer interface {
    // PutImageFile puts the image file.
    PutImageFile(
        ctx context.Context,
        container app.EnvStdoutContainer,
        imageRef ImageRef,
    ) (io.WriteCloser, error)
}

Writer is a writer for Buf.

func NewWriter Uses

func NewWriter(
    logger *zap.Logger,
) Writer

NewWriter returns a new Writer.

Package buffetch imports 18 packages (graph) and is imported by 1 packages. Updated 2020-10-20. Refresh now. Tools for package owners.