protoserver

package
v0.0.0-...-c5da4db Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2017 License: MIT Imports: 17 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMustSpecifyRegisterFunc is used when a register func is nil.
	ErrMustSpecifyRegisterFunc = errors.New("must specify registerFunc")
)

Functions

func GetAndServe

func GetAndServe(
	registerFunc func(*grpc.Server),
	options ServeOptions,
) error

GetAndServe is GetServeEnv with Serve.

func GetAndServeWithHTTP

func GetAndServeWithHTTP(
	registerFunc func(*grpc.Server),
	httpRegisterFunc func(context.Context, *runtime.ServeMux, *grpc.ClientConn) error,
	options ServeWithHTTPOptions,
) error

GetAndServeWithHTTP is GetServeEnv and GetHandlerEnv with ServeWithHTTP.

func Serve

func Serve(
	registerFunc func(*grpc.Server),
	options ServeOptions,
	serveEnv ServeEnv,
) (retErr error)

Serve serves stuff.

func ServeWithHTTP

func ServeWithHTTP(
	registerFunc func(*grpc.Server),
	httpRegisterFunc func(context.Context, *runtime.ServeMux, *grpc.ClientConn) error,
	options ServeWithHTTPOptions,
	serveEnv ServeEnv,
	handlerEnv pkghttp.HandlerEnv,
) (retErr error)

ServeWithHTTP serves stuff.

Types

type ServeEnv

type ServeEnv struct {
	// Default is 7070.
	GRPCPort uint16 `env:"GRPC_PORT,default=7070"`
}

ServeEnv are environment variables for serving.

func GetServeEnv

func GetServeEnv() (ServeEnv, error)

GetServeEnv gets a ServeEnv using environment variables.

type ServeOptions

type ServeOptions struct {
	Version *protoversion.Version
}

ServeOptions represent optional fields for serving.

type ServeWithHTTPOptions

type ServeWithHTTPOptions struct {
	ServeOptions
	HTTPHandlerModifier func(http.Handler) (http.Handler, error)
}

ServeWithHTTPOptions represent optional fields for serving.

type ServerFinished

type ServerFinished struct {
	Error    string                    `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"`
	Duration *google_protobuf.Duration `protobuf:"bytes,2,opt,name=duration" json:"duration,omitempty"`
}

func (*ServerFinished) Descriptor

func (*ServerFinished) Descriptor() ([]byte, []int)

func (*ServerFinished) GetDuration

func (m *ServerFinished) GetDuration() *google_protobuf.Duration

func (*ServerFinished) GetError

func (m *ServerFinished) GetError() string

func (*ServerFinished) ProtoMessage

func (*ServerFinished) ProtoMessage()

func (*ServerFinished) Reset

func (m *ServerFinished) Reset()

func (*ServerFinished) String

func (m *ServerFinished) String() string

type ServerStarted

type ServerStarted struct {
	Port     uint32 `protobuf:"varint,1,opt,name=port" json:"port,omitempty"`
	HttpPort uint32 `protobuf:"varint,2,opt,name=http_port,json=httpPort" json:"http_port,omitempty"`
}

func (*ServerStarted) Descriptor

func (*ServerStarted) Descriptor() ([]byte, []int)

func (*ServerStarted) GetHttpPort

func (m *ServerStarted) GetHttpPort() uint32

func (*ServerStarted) GetPort

func (m *ServerStarted) GetPort() uint32

func (*ServerStarted) ProtoMessage

func (*ServerStarted) ProtoMessage()

func (*ServerStarted) Reset

func (m *ServerStarted) Reset()

func (*ServerStarted) String

func (m *ServerStarted) String() string

Jump to

Keyboard shortcuts

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