grpc

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name               string                         // Name of the GRPC Server
	Address            string                         // Address on which the server will be accessible
	Port               uint16                         // Port on which the server will be accessible
	TLSEnabled         bool                           // Whether or not traffic should be served via HTTPS
	TLSCrtPath         string                         // Location of TLS Certificate
	TLSKeyPath         string                         // Location of TLS Key
	ServerRegistration func(*grpc.Server)             // Callback for registering GRPC API Servers
	StreamInterceptors []grpc.StreamServerInterceptor // A list of global GRPC stream interceptor functions to be called. Order is honored left to right.
	UnaryInterceptors  []grpc.UnaryServerInterceptor  // A list of global GRPC unary interceptor functions to be called. Order is honored left to right.
	CancelSignals      []os.Signal                    // OS Signals to be used to cancel running servers. Defaults to SIGINT/`os.Interrupt`.
}

Config contains the configuration necessary for running a GRPC Server.

func NewDefaultConfig

func NewDefaultConfig(name string, serverRegistration func(*grpc.Server)) Config

NewDefaultConfig returns a default GRPC server config object. The caller must still supply the name of the server and a serverRegistration callback. The serverRegistration callback is a function that registers GRPC API servers with the provided GRPC server.

func (Config) NewServer

func (c Config) NewServer() Server

NewServer creates and returns a configured Server object given a GRPC configuration object.

func (*Config) RegisterFlags

func (c *Config) RegisterFlags(flags *pflag.FlagSet)

RegisterFlags registers GRPC flags with pflags

type Server

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

Server contains the configured GRPC server and related components

func (Server) Run

func (s Server) Run() error

Run starts the GRPC server. The function returns an error if the GRPC server cannot bind to its listen address. Additionally, this function is blocking and will not return until one of the configured cancel signals is received.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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