Documentation ¶
Overview ¶
Package server defines the Options of server
Package server .
Index ¶
- func RegisterShutdownHook(h func())
- func RegisterStartHook(h func())
- type Hooks
- type InvokeCaller
- type Invoker
- type Option
- func WithACLRules(rules ...acl.RejectFunc) Option
- func WithBoundHandler(h remote.BoundHandler) Option
- func WithCodec(c remote.Codec) Option
- func WithDiagnosisService(ds diagnosis.Service) Option
- func WithErrorHandler(f func(error) error) Option
- func WithExitSignal(f func() <-chan error) Option
- func WithExitWaitTime(timeout time.Duration) Option
- func WithGeneric(g generic.Generic) Option
- func WithLimit(lim *limit.Option) Option
- func WithLimitReporter(r limiter.LimitReporter) Option
- func WithLogger(logger klog.FormatLogger) Option
- func WithMaxConnIdleTime(timeout time.Duration) Option
- func WithMetaHandler(h remote.MetaHandler) Option
- func WithMiddleware(mw endpoint.Middleware) Option
- func WithMiddlewareBuilder(mwb endpoint.MiddlewareBuilder, funcName ...string) Option
- func WithMultiProtocol() Optiondeprecated
- func WithMuxTransport() Option
- func WithPayloadCodec(c remote.PayloadCodec) Option
- func WithProxy(p proxy.ReverseProxy) Option
- func WithReadWriteTimeout(d time.Duration) Option
- func WithRegistry(r registry.Registry) Option
- func WithRegistryInfo(info *registry.Info) Option
- func WithReusePort(reuse bool) Option
- func WithServerBasicInfo(ebi *rpcinfo.EndpointBasicInfo) Option
- func WithServiceAddr(addr net.Addr) Option
- func WithStatsLevel(level stats.Level) Option
- func WithSuite(suite Suite) Option
- func WithTracer(c stats.Tracer) Option
- func WithTransHandlerFactory(f remote.ServerTransHandlerFactory) Option
- func WithTransServerFactory(f remote.TransServerFactory) Option
- type Options
- type Server
- type Suite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterShutdownHook ¶
func RegisterShutdownHook(h func())
RegisterShutdownHook add hook which is executed after the server shutdown.
func RegisterStartHook ¶
func RegisterStartHook(h func())
RegisterStartHook add hook which is executed after the server starts.
Types ¶
type InvokeCaller ¶
InvokeCaller is the abstraction for invoker call.
type Invoker ¶
type Invoker interface { RegisterService(svcInfo *serviceinfo.ServiceInfo, handler interface{}) error Init() (err error) InvokeCaller }
Invoker is the abstraction for invoker.
type Option ¶
type Option = internal_server.Option
Option is the only way to config server.
func WithACLRules ¶
func WithACLRules(rules ...acl.RejectFunc) Option
WithACLRules sets the ACL rules.
func WithBoundHandler ¶
func WithBoundHandler(h remote.BoundHandler) Option
WithBoundHandler adds remote.BoundHandler for server.
func WithDiagnosisService ¶
WithDiagnosisService sets the diagnosis service for gathering debug informations.
func WithErrorHandler ¶
WithErrorHandler sets the error handler.
func WithExitSignal ¶ added in v0.1.0
WithExitSignal adds ExitSignal for server.
func WithExitWaitTime ¶
WithExitWaitTime sets the wait duration for graceful shutdown.
func WithGeneric ¶
WithGeneric set Generic type for generic call
func WithLimit ¶
WithLimit sets the limitation of concurrent connections or max QPS. IMPORTANT: this option is not stable, and will be changed or removed in the future!!! We don't promise compatibility for this option in future versions!!!
func WithLimitReporter ¶
func WithLimitReporter(r limiter.LimitReporter) Option
WithLimitReporter do report when server limit happen
func WithLogger ¶
func WithLogger(logger klog.FormatLogger) Option
WithLogger sets the Logger for kitex server. Deprecated: server uses the global klog.DefaultLogger.
func WithMaxConnIdleTime ¶
WithMaxConnIdleTime sets the max idle time on connection from clients.
func WithMetaHandler ¶
func WithMetaHandler(h remote.MetaHandler) Option
WithMetaHandler adds a MetaHandler.
func WithMiddleware ¶
func WithMiddleware(mw endpoint.Middleware) Option
WithMiddleware adds middleware for server to handle request.
func WithMiddlewareBuilder ¶
func WithMiddlewareBuilder(mwb endpoint.MiddlewareBuilder, funcName ...string) Option
WithMiddlewareBuilder adds middleware that depend on context for server to handle request
func WithMultiProtocol
deprecated
func WithMultiProtocol() Option
Deprecated: Useless option now, server support multi protocols by default. IMPORTANT: this option will be deleted in the future!!!
func WithMuxTransport ¶
func WithMuxTransport() Option
WithMuxTransport specifies the transport type to be mux.
func WithPayloadCodec ¶
func WithPayloadCodec(c remote.PayloadCodec) Option
WithPayloadCodec to set a payloadCodec that handle other payload which not support by kitex
func WithProxy ¶
func WithProxy(p proxy.ReverseProxy) Option
WithProxy stes the backward Proxy for server.
func WithReadWriteTimeout ¶
WithReadWriteTimeout sets the read/write timeout on network. IMPORTANT: this option is not stable, and will be changed or removed in the future!!! We don't promise compatibility for this option in future versions!!!
func WithRegistry ¶
WithRegistry to set a Registry to register service
func WithRegistryInfo ¶
WithRegistryInfo to set Registry Info if needed. It is used to add customized info and is suggested to use with WithRegistry option.
func WithReusePort ¶ added in v0.1.0
WithReusePort sets SO_REUSEPORT on listener.
func WithServerBasicInfo ¶
func WithServerBasicInfo(ebi *rpcinfo.EndpointBasicInfo) Option
WithServerBasicInfo provides initial information for client endpoint in RPCInfo.
func WithServiceAddr ¶
WithServiceAddr sets the listen address for server.
func WithStatsLevel ¶
WithStatsLevel sets the stats level for server.
func WithTransHandlerFactory ¶
func WithTransHandlerFactory(f remote.ServerTransHandlerFactory) Option
WithTransHandlerFactory sets the TransHandlerFactory for server.
func WithTransServerFactory ¶
func WithTransServerFactory(f remote.TransServerFactory) Option
WithTransServerFactory sets the TransServerFactory for server.
type Server ¶
type Server interface { RegisterService(svcInfo *serviceinfo.ServiceInfo, handler interface{}) error Run() error Stop() error }
Server is a abstraction of a RPC server. It accepts connections and dispatches them to the service registered to it.