rpc

package
Version: v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

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
)

Variables

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

Functions

func GetDefaultServerOpts

func GetDefaultServerOpts() []grpc.ServerOption

Types

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 {
	entry.Abc
	Register(handler interface{}, opts ...Opt)
	InitOpts(opts ...grpc.ServerOption)
	UnaryInterceptor(interceptors ...grpc.UnaryServerInterceptor)
	StreamInterceptor(interceptors ...grpc.StreamServerInterceptor)
}

func New

func New(name string) Entry

type Opt

type Opt func(opts *Opts)

type Opts

type Opts 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