server

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package server defines the Options of server

Package server defines the Options about remote transport of client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyOptions

func ApplyOptions(opts []Option, o *Options)

ApplyOptions applies the given options.

func ApplyRegisterOptions added in v0.9.0

func ApplyRegisterOptions(opts []RegisterOption, o *RegisterOptions)

ApplyRegisterOptions applies the given register options.

func DefaultSupportedTransportsFunc added in v0.3.3

func DefaultSupportedTransportsFunc(option remote.ServerOption) []string

func DefaultSysExitSignal added in v0.1.0

func DefaultSysExitSignal() <-chan error

func SysExitSignal added in v0.1.0

func SysExitSignal() chan os.Signal

Types

type Config

type Config struct {
	Address net.Addr

	// Duration that server waits for to allow any existing connection to be closed gracefully.
	ExitWaitTime time.Duration

	// Duration that server waits for after error occurs during connection accepting.
	AcceptFailedDelayTime time.Duration

	// Duration that the accepted connection waits for to read or write data, only works under NIO.
	MaxConnectionIdleTime time.Duration
}

Config contains some server-side configuration.

func NewConfig

func NewConfig() *Config

NewConfig creates a new default config.

type Limit added in v0.3.2

type Limit struct {
	Limits        *limit.Option
	LimitReporter limiter.LimitReporter
	ConLimit      limiter.ConcurrencyLimiter
	QPSLimit      limiter.RateLimiter

	// QPSLimitPostDecode is true to indicate that the QPS limiter takes effect in
	// the OnMessage callback, and false for the OnRead callback.
	// Usually when the server is multiplexed, Kitex set it to True by default.
	QPSLimitPostDecode bool
}

type Option

type Option struct {
	F func(o *Options, di *utils.Slice)
}

Option is the only way to config a server.

type Options

type Options struct {
	Svr      *rpcinfo.EndpointBasicInfo
	Configs  rpcinfo.RPCConfig
	LockBits int
	Once     *configutil.OptionOnce

	MetaHandlers []remote.MetaHandler

	RemoteOpt  *remote.ServerOption
	ErrHandle  func(context.Context, error) error
	ExitSignal func() <-chan error
	Proxy      proxy.ReverseProxy

	// Registry is used for service registry.
	Registry registry.Registry
	// RegistryInfo is used to in registry.
	RegistryInfo *registry.Info

	ACLRules []acl.RejectFunc
	Limit    Limit

	MWBs []endpoint.MiddlewareBuilder

	Bus    event.Bus
	Events event.Queue

	SupportedTransportsFunc func(option remote.ServerOption) []string

	// DebugInfo should only contain objects that are suitable for json serialization.
	DebugInfo    utils.Slice
	DebugService diagnosis.Service

	// Observability
	TracerCtl  *rpcinfo.TraceController
	StatsLevel *stats.Level

	BackupOpt backup.Options

	// Streaming
	Streaming stream.StreamingConfig // old version streaming API config
	StreamX   StreamXOptions         // new version streaming API config

	RefuseTrafficWithoutServiceName bool
	EnableContextTimeout            bool
}

Options is used to initialize the server.

func NewOptions

func NewOptions(opts []Option) *Options

NewOptions creates a default options.

type RegisterOption added in v0.9.0

type RegisterOption struct {
	F func(o *RegisterOptions)
}

RegisterOption is the only way to config service registration.

type RegisterOptions added in v0.9.0

type RegisterOptions struct {
	IsFallbackService bool
	Middlewares       []endpoint.Middleware
}

RegisterOptions is used to config service registration.

func NewRegisterOptions added in v0.9.0

func NewRegisterOptions(opts []RegisterOption) *RegisterOptions

NewRegisterOptions creates a register options.

type StreamXOptions added in v0.12.0

type StreamXOptions struct {
	StreamMiddlewares     []streamx.StreamMiddleware
	StreamRecvMiddlewares []streamx.StreamRecvMiddleware
	StreamSendMiddlewares []streamx.StreamSendMiddleware
	Provider              streamx.ServerProvider
}

Jump to

Keyboard shortcuts

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