appprotoexec

package
v0.20.5 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package appprotoexec provides appproto.Handlers for binary plugins.

Index

Constants

View Source
const (
	// DefaultMajorVersion is the default major version.
	DefaultMajorVersion = 3
	// DefaultMinorVersion is the default minor version.
	DefaultMinorVersion = 12
	// DefaultPatchVersion is the default patch version.
	DefaultPatchVersion = 3
	// DefaultSuffixVersion is the default suffix version.
	DefaultSuffixVersion = ""
)

Variables

View Source
var (
	// ProtocProxyPluginNames are the names of the plugins that should be proxied through protoc
	// in the absense of a binary.
	ProtocProxyPluginNames = map[string]struct{}{
		"cpp":    {},
		"csharp": {},
		"java":   {},
		"js":     {},
		"objc":   {},
		"php":    {},
		"python": {},
		"ruby":   {},
	}
)

Functions

func NewBinaryHandler

func NewBinaryHandler(
	logger *zap.Logger,
	pluginPath string,
) (appproto.Handler, error)

NewBinaryHandler returns a new Handler for the given plugin path.

exec.LookPath is called on the pluginPath, and error is returned if exec.LookPath returns an error.

func NewHandler

func NewHandler(
	logger *zap.Logger,
	pluginName string,
	protocPath string,
	pluginPath string,
) (appproto.Handler, error)

NewHandler returns a new Handler based on the plugin name and optional path.

protocPath and pluginPath are optional.

  • If the plugin path is set, this returns a new binary handler for that path.
  • If the plugin path is unset, this does exec.LookPath for a binary named protoc-gen-pluginName, and if one is found, a new binary handler is returned for this.
  • Else, if the name is in ProtocProxyPluginNames, this returns a new protoc proxy handler.
  • Else, this returns error.

func NewProtocProxyHandler

func NewProtocProxyHandler(
	logger *zap.Logger,
	protocPath string,
	pluginName string,
) (appproto.Handler, error)

NewProtocProxyHandler returns a new Handler that proxies through protoc.

This can be used for the builtin plugins.

exec.LookPath is called on the protocPath, and error is returned if exec.LookPath returns an error.

Types

This section is empty.

Directories

Path Synopsis
cmd
protoc-gen-proxy
Package main defines protoc-gen-proxy, which is a testing protoc plugin that proxies to other plugins or to protoc.
Package main defines protoc-gen-proxy, which is a testing protoc plugin that proxies to other plugins or to protoc.

Jump to

Keyboard shortcuts

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