grpc_builder

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultContentType = "application/grpc"
	DefaultMaxMsgSize  = 1024 * 1024 * 4
	DefaultTimeout     = time.Second * 2
)

Variables

This section is empty.

Functions

func EnableDebug

func EnableDebug(s *grpc.Server)

func EnableHealth

func EnableHealth(srv string, s *grpc.Server)

func EnableReflection

func EnableReflection(s *grpc.Server)

func ListGRPCResources

func ListGRPCResources(server *grpc.Server) []string

ListGRPCResources is a helper function that lists all URLs that are registered on gRPC server.

This makes it easy to register all the relevant routes in your HTTP router of choice.

Types

type Builder

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

func New

func New() Builder

func (*Builder) Build

func (t *Builder) Build(cfg *Cfg) (err error)

func (*Builder) BuildOpts

func (t *Builder) BuildOpts(cfg *Cfg) []grpc.ServerOption

func (*Builder) Get

func (t *Builder) Get() *grpc.Server

func (*Builder) StreamInterceptor

func (t *Builder) StreamInterceptor(interceptors ...grpc.StreamServerInterceptor)

func (*Builder) UnaryInterceptor

func (t *Builder) UnaryInterceptor(interceptors ...grpc.UnaryServerInterceptor)

type Cfg

type Cfg struct {
	Codec                 string          `json:"codec"`
	ConnectionTimeout     time.Duration   `json:"connection_timeout"`
	Cp                    string          `json:"cp"`
	Creds                 string          `json:"creds"`
	Dc                    string          `json:"dc"`
	HeaderTableSize       int64           `json:"header_table_size"`
	InitialConnWindowSize int64           `json:"initial_conn_window_size"`
	InitialWindowSize     int64           `json:"initial_window_size"`
	KeepaliveParams       KeepaliveParams `json:"keepalive_params"`
	KeepalivePolicy       KeepalivePolicy `json:"keepalive_policy"`
	MaxConcurrentStreams  int64           `json:"max_concurrent_streams"`
	MaxHeaderListSize     int64           `json:"max_header_list_size"`
	MaxRecvMsgSize        int             `json:"max_recv_msg_size"`
	MaxSendMsgSize        int             `json:"max_send_msg_size"`
	ReadBufferSize        int64           `json:"read_buffer_size"`
	WriteBufferSize       int64           `json:"write_buffer_size"`
}

func GetDefaultCfg

func GetDefaultCfg() *Cfg

type GRPCStats

type GRPCStats struct {
	Duration time.Duration
	Method   string
	Failed   float64
	Success  float64
}

type KeepaliveParams

type KeepaliveParams struct {
	MaxConnectionAge      time.Duration `json:"max_connection_age"`
	MaxConnectionAgeGrace time.Duration `json:"max_connection_age_grace"`
	MaxConnectionIdle     time.Duration `json:"max_connection_idle"`
	Time                  time.Duration `json:"time"`
	Timeout               time.Duration `json:"timeout"`
}

func (KeepaliveParams) ToCfg

type KeepalivePolicy

type KeepalivePolicy struct {
	MinTime             time.Duration `json:"min_time"`
	PermitWithoutStream bool          `json:"permit_without_stream"`
}

Jump to

Keyboard shortcuts

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