Version: v0.0.19 Latest Latest

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

Go to latest
Published: Mar 20, 2021 License: Apache-2.0 Imports: 35 Imported by: 0




View Source
const (
	Name = "grpc_entry"

	// The register expiry time
	RegisterTTL = time.Minute
	// The interval on which to register
	RegisterInterval = time.Second * 30

	// DefaultMaxMsgSize define maximum message size that server can send
	// or receive.  Default value is 4MB.
	DefaultMaxMsgSize           = 1024 * 1024 * 4
	DefaultSleepAfterDeregister = time.Second * 2
	// The register expiry time
	DefaultRegisterTTL = time.Minute
	// The interval on which to register
	DefaultRegisterInterval = time.Second * 30


View Source
var DefaultCfg = Cfg{
	MaxReceiveMessageSize: 1,
	MaxSendMessageSize:    1,
View Source
var (
	DefaultId = uuid.New().String()


func GetDefaultServerOpts

func GetDefaultServerOpts() []grpc.ServerOption


type Cfg

type Cfg struct {
	Gw struct {
		Addr string `json:"addr"`
	} `json:"gw"`
	SleepAfterDeregister  time.Duration `json:"SleepAfterDeregister"`
	RegisterInterval      time.Duration `json:"RegisterInterval"`
	RegisterTTL           string        `json:"register_ttl"`
	Address               string        `json:"address"`
	Advertise             string        `json:"advertise"`
	Codec                 string        `json:"codec"`
	ConnectionTimeout     string        `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       struct {
		MaxConnectionAge      string `json:"max_connection_age"`
		MaxConnectionAgeGrace string `json:"max_connection_age_grace"`
		MaxConnectionIdle     string `json:"max_connection_idle"`
		Time                  string `json:"time"`
		Timeout               string `json:"timeout"`
	} `json:"keepalive_params"`
	KeepalivePolicy struct {
		MinTime             string `json:"min_time"`
		PermitWithoutStream bool   `json:"permit_without_stream"`
	} `json:"keepalive_policy"`
	MaxConcurrentStreams  int64 `json:"max_concurrent_streams"`
	MaxHeaderListSize     int64 `json:"max_header_list_size"`
	MaxReceiveMessageSize int   `json:"max_receive_message_size"`
	MaxSendMessageSize    int   `json:"max_send_message_size"`
	ReadBufferSize        int64 `json:"read_buffer_size"`
	WriteBufferSize       int64 `json:"write_buffer_size"`
	// contains filtered or unexported fields

type Entry

type Entry interface {
	Register(handler interface{}, opts ...Option)
	InitOpts(opts ...grpc.ServerOption)
	UnaryInterceptor(interceptors ...grpc.UnaryServerInterceptor)
	StreamInterceptor(interceptors ...grpc.StreamServerInterceptor)

func New

func New(name string) Entry

type Option

type Option func(opts *Options)

type Options

type Options struct{}

type WrappedServerStream

type WrappedServerStream = grpcMiddleware.WrappedServerStream

func WrapServerStream

func WrapServerStream(stream grpc.ServerStream) *WrappedServerStream

Jump to

Keyboard shortcuts

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