engine

package
v0.0.0-...-51958b5 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGatewayServer

func NewGatewayServer(c *config.Config) api.Interface

NewGatewayServer creates GrpcServer instance.

func NewGrpcServer

func NewGrpcServer(c *config.Config) api.Interface

NewGrpcServer creates GrpcServer instance.

func NewMuxServer

func NewMuxServer(mux cmux.CMux, lis net.Listener) api.Interface

NewMuxServer creates MuxServer instance.

Types

type Engine

type Engine struct {
	*config.Config
	// contains filtered or unexported fields
}

Engine is the framework instance.

func New

func New(opts ...Option) *Engine

New creates a server intstance.

func (*Engine) Serve

func (e *Engine) Serve() error

Serve starts gRPC and Gateway servers.

func (*Engine) Shutdown

func (e *Engine) Shutdown()

Shutdown closes servers.

type GatewayServer

type GatewayServer struct {
	*config.Config
	// contains filtered or unexported fields
}

GatewayServer wraps gRPC gateway server setup process.

func (*GatewayServer) Serve

func (s *GatewayServer) Serve(l net.Listener) error

Serve implements Server.Shutdown

func (*GatewayServer) Shutdown

func (s *GatewayServer) Shutdown()

Shutdown implements Server.Shutdown

type GrpcServer

type GrpcServer struct {
	*config.Config
	// contains filtered or unexported fields
}

GrpcServer wraps grpc.Server setup process.

func (*GrpcServer) Serve

func (s *GrpcServer) Serve(l net.Listener) error

Serve implements Server.Shutdown

func (*GrpcServer) Shutdown

func (s *GrpcServer) Shutdown()

Shutdown implements Server.Shutdown

type MuxServer

type MuxServer struct {
	// contains filtered or unexported fields
}

MuxServer wraps a connection multiplexer and a listener.

func (*MuxServer) Serve

func (s *MuxServer) Serve(net.Listener) error

Serve implements Server.Serve

func (*MuxServer) Shutdown

func (s *MuxServer) Shutdown()

Shutdown implements Server.Shutdown

type Option

type Option func(*config.Config)

Option configures a gRPC and a gateway server.

func WithAddr

func WithAddr(network, addr string) Option

WithAddr returns an Option that sets an network address for a gRPC and a gateway server.

func WithDefaultLogger

func WithDefaultLogger() Option

WithDefaultLogger returns an Option that sets default grpclogger.LoggerV2 object.

func WithGatewayAddr

func WithGatewayAddr(network, addr string) Option

WithGatewayAddr returns an Option that sets an network address for a gateway server.

func WithGatewayDialOptions

func WithGatewayDialOptions(opts ...grpc.DialOption) Option

WithGatewayDialOptions returns an Option that sets grpc.DialOption(s) to a gRPC clinet used by a gateway server.

func WithGatewayMuxOptions

func WithGatewayMuxOptions(opts ...runtime.ServeMuxOption) Option

WithGatewayMuxOptions returns an Option that sets runtime.ServeMuxOption(s) to a gateway server.

func WithGatewayServerConfig

func WithGatewayServerConfig(cfg *config.HTTPServerConfig) Option

WithGatewayServerConfig returns an Option that specifies http.api.Server configuration to a gateway server.

func WithGatewayServerMiddlewares

func WithGatewayServerMiddlewares(middlewares ...middleware.HTTPServerMiddleware) Option

WithGatewayServerMiddlewares returns an Option that sets middleware(s) for http.api.Server to a gateway server.

func WithGatewayServerStreamInterceptors

func WithGatewayServerStreamInterceptors(interceptors ...grpc.StreamClientInterceptor) Option

WithGatewayServerStreamInterceptors returns an Option that sets stream interceptor(s) for a gRPC client used by a gateway server.

func WithGatewayServerUnaryInterceptors

func WithGatewayServerUnaryInterceptors(interceptors ...grpc.UnaryClientInterceptor) Option

WithGatewayServerUnaryInterceptors returns an Option that sets unary interceptor(s) for a gRPC client used by a gateway server.

func WithGrpcAddr

func WithGrpcAddr(network, addr string) Option

WithGrpcAddr returns an Option that sets an network address for a gRPC server.

func WithGrpcInternalAddr

func WithGrpcInternalAddr(network, addr string) Option

WithGrpcInternalAddr returns an Option that sets an network address connected by a gateway server.

func WithGrpcServerOptions

func WithGrpcServerOptions(opts ...grpc.ServerOption) Option

WithGrpcServerOptions returns an Option that sets grpc.ServerOption(s) to a gRPC server.

func WithGrpcServerStreamInterceptors

func WithGrpcServerStreamInterceptors(interceptors ...grpc.StreamServerInterceptor) Option

WithGrpcServerStreamInterceptors returns an Option that sets stream interceptor(s) for a gRPC server.

func WithGrpcServerUnaryInterceptors

func WithGrpcServerUnaryInterceptors(interceptors ...grpc.UnaryServerInterceptor) Option

WithGrpcServerUnaryInterceptors returns an Option that sets unary interceptor(s) for a gRPC server.

func WithPassedHeader

func WithPassedHeader(decider middleware.PassedHeaderDeciderFunc) Option

WithPassedHeader returns an Option that sets configurations about passed headers for a gateway server.

func WithServers

func WithServers(svrs ...api.Server) Option

WithServers returns an Option that sets gRPC service server implementation(s).

Jump to

Keyboard shortcuts

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