Documentation ¶
Overview ¶
Package server provides APIs for registering services and starting an RPC server.
Index ¶
- func SetProServices(sd *InternalService)
- type InternalService
- type MethodInfo
- type Server
- type ServerOption
- func SetServerApplication(application *global.ApplicationConfig) ServerOption
- func SetServerMetrics(metrics *global.MetricsConfig) ServerOption
- func SetServerOtel(otel *global.OtelConfig) ServerOption
- func SetServerProtocols(pros map[string]*global.ProtocolConfig) ServerOption
- func SetServerProvider(provider *global.ProviderConfig) ServerOption
- func SetServerRegistries(regs map[string]*global.RegistryConfig) ServerOption
- func SetServerShutdown(shutdown *global.ShutdownConfig) ServerOption
- func WithServerAccesslog(accesslog string) ServerOption
- func WithServerAdaptiveService() ServerOption
- func WithServerAdaptiveServiceVerbose() ServerOption
- func WithServerAuth(auth string) ServerOption
- func WithServerCluster(cluster string) ServerOption
- func WithServerClusterAdaptiveService() ServerOption
- func WithServerClusterAvailable() ServerOption
- func WithServerClusterBroadcast() ServerOption
- func WithServerClusterFailBack() ServerOption
- func WithServerClusterFailFast() ServerOption
- func WithServerClusterFailOver() ServerOption
- func WithServerClusterFailSafe() ServerOption
- func WithServerClusterForking() ServerOption
- func WithServerClusterZoneAware() ServerOption
- func WithServerExecuteLimit(exeLimit string) ServerOption
- func WithServerExecuteLimitRejectedHandler(exeRejHandler string) ServerOption
- func WithServerFilter(filter string) ServerOption
- func WithServerFilterConf(conf interface{}) ServerOption
- func WithServerGroup(group string) ServerOption
- func WithServerJSON() ServerOption
- func WithServerLoadBalance(lb string) ServerOption
- func WithServerLoadBalanceConsistentHashing() ServerOption
- func WithServerLoadBalanceLeastActive() ServerOption
- func WithServerLoadBalanceP2C() ServerOption
- func WithServerLoadBalanceRandom() ServerOption
- func WithServerLoadBalanceRoundRobin() ServerOption
- func WithServerNotRegister() ServerOption
- func WithServerParam(k, v string) ServerOption
- func WithServerParamSign(paramSign string) ServerOption
- func WithServerProtocol(opts ...protocol.Option) ServerOption
- func WithServerProtocolIDs(protocolIDs []string) ServerOption
- func WithServerRegistry(opts ...registry.Option) ServerOption
- func WithServerRegistryIDs(registryIDs []string) ServerOption
- func WithServerRetries(retries int) ServerOption
- func WithServerSerialization(ser string) ServerOption
- func WithServerTag(tag string) ServerOption
- func WithServerToken(token string) ServerOption
- func WithServerTpsLimitRate(rate int) ServerOption
- func WithServerTpsLimitRejectedHandler(rejHandler string) ServerOption
- func WithServerTpsLimitStrategy(strategy string) ServerOption
- func WithServerTpsLimiter(limiter string) ServerOption
- func WithServerVersion(version string) ServerOption
- func WithServerWarmUp(warmUp time.Duration) ServerOption
- func WithServerWarmup(milliSeconds time.Duration) ServerOption
- type ServerOptions
- type ServiceDefinition
- type ServiceInfo
- type ServiceOption
- func SetApplication(application *global.ApplicationConfig) ServiceOption
- func SetProtocols(pros map[string]*global.ProtocolConfig) ServiceOption
- func SetProvider(provider *global.ProviderConfig) ServiceOption
- func SetRegistries(regs map[string]*global.RegistryConfig) ServiceOption
- func SetService(service *global.ServiceConfig) ServiceOption
- func WithAccesslog(accesslog string) ServiceOption
- func WithAuth(auth string) ServiceOption
- func WithCluster(cluster string) ServiceOption
- func WithClusterAdaptiveService() ServiceOption
- func WithClusterAvailable() ServiceOption
- func WithClusterBroadcast() ServiceOption
- func WithClusterFailBack() ServiceOption
- func WithClusterFailFast() ServiceOption
- func WithClusterFailOver() ServiceOption
- func WithClusterFailSafe() ServiceOption
- func WithClusterForking() ServiceOption
- func WithClusterZoneAware() ServiceOption
- func WithExecuteLimit(exeLimit string) ServiceOption
- func WithExecuteLimitRejectedHandler(exeRejHandler string) ServiceOption
- func WithFilter(filter string) ServiceOption
- func WithGroup(group string) ServiceOption
- func WithInterface(intf string) ServiceOption
- func WithJSON() ServiceOption
- func WithLoadBalance(lb string) ServiceOption
- func WithLoadBalanceConsistentHashing() ServiceOption
- func WithLoadBalanceLeastActive() ServiceOption
- func WithLoadBalanceP2C() ServiceOption
- func WithLoadBalanceRandom() ServiceOption
- func WithLoadBalanceRoundRobin() ServiceOption
- func WithMethod(opts ...config.MethodOption) ServiceOption
- func WithNotRegister() ServiceOption
- func WithParam(k, v string) ServiceOption
- func WithParamSign(paramSign string) ServiceOption
- func WithProtocol(opts ...protocol.Option) ServiceOption
- func WithProtocolIDs(protocolIDs []string) ServiceOption
- func WithRegistry(opts ...registry.Option) ServiceOption
- func WithRegistryIDs(registryIDs []string) ServiceOption
- func WithRetries(retries int) ServiceOption
- func WithSerialization(ser string) ServiceOption
- func WithTag(tag string) ServiceOption
- func WithToken(token string) ServiceOption
- func WithTpsLimitRate(rate int) ServiceOption
- func WithTpsLimitRejectedHandler(rejHandler string) ServiceOption
- func WithTpsLimitStrategy(strategy string) ServiceOption
- func WithTpsLimiter(limiter string) ServiceOption
- func WithVersion(version string) ServiceOption
- func WithWarmUp(warmUp time.Duration) ServiceOption
- func WithWarmup(milliSeconds time.Duration) ServiceOption
- type ServiceOptions
- func (svcOpts *ServiceOptions) ExportWithInfo(info *ServiceInfo) error
- func (svcOpts *ServiceOptions) ExportWithoutInfo() error
- func (svcOpts *ServiceOptions) GetExportedUrls() []*common.URL
- func (svcOpts *ServiceOptions) Implement(rpcService common.RPCService)
- func (svcOpts *ServiceOptions) InitExported()
- func (svcOpts *ServiceOptions) IsExport() bool
- func (svcOpts *ServiceOptions) Prefix() string
- func (svcOpts *ServiceOptions) Unexport()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetProServices ¶
func SetProServices(sd *InternalService)
Types ¶
type InternalService ¶
type InternalService struct { // This is required // internal service name Name string // This is required // This options is service configuration // Return serviceDefinition and bool, where bool indicates whether it is exported Init func(options *ServiceOptions) (*ServiceDefinition, bool) // This options is InternalService.svcOpts itself BeforeExport func(options *ServiceOptions) // This options is InternalService.svcOpts itself AfterExport func(options *ServiceOptions, err error) // Priority of service exposure // Lower numbers have the higher priority // The default priority is 0 // The metadata service is exposed at the end // If you have no requirements for the order of service exposure, you can use the default priority or not set Priority int // contains filtered or unexported fields }
InternalService for dubbo internal services
type MethodInfo ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(opts ...ServerOption) (*Server, error)
func (*Server) Register ¶
func (s *Server) Register(handler interface{}, info *ServiceInfo, opts ...ServiceOption) error
Register assemble invoker chains like ProviderConfig.Load, init a service per call
type ServerOption ¶
type ServerOption func(*ServerOptions)
func SetServerApplication ¶
func SetServerApplication(application *global.ApplicationConfig) ServerOption
func SetServerMetrics ¶
func SetServerMetrics(metrics *global.MetricsConfig) ServerOption
func SetServerOtel ¶
func SetServerOtel(otel *global.OtelConfig) ServerOption
func SetServerProtocols ¶
func SetServerProtocols(pros map[string]*global.ProtocolConfig) ServerOption
func SetServerProvider ¶
func SetServerProvider(provider *global.ProviderConfig) ServerOption
func SetServerRegistries ¶
func SetServerRegistries(regs map[string]*global.RegistryConfig) ServerOption
func SetServerShutdown ¶
func SetServerShutdown(shutdown *global.ShutdownConfig) ServerOption
func WithServerAccesslog ¶
func WithServerAccesslog(accesslog string) ServerOption
func WithServerAdaptiveService ¶
func WithServerAdaptiveService() ServerOption
func WithServerAdaptiveServiceVerbose ¶
func WithServerAdaptiveServiceVerbose() ServerOption
func WithServerAuth ¶
func WithServerAuth(auth string) ServerOption
func WithServerCluster ¶
func WithServerCluster(cluster string) ServerOption
func WithServerClusterAdaptiveService ¶
func WithServerClusterAdaptiveService() ServerOption
func WithServerClusterAvailable ¶
func WithServerClusterAvailable() ServerOption
func WithServerClusterBroadcast ¶
func WithServerClusterBroadcast() ServerOption
func WithServerClusterFailBack ¶
func WithServerClusterFailBack() ServerOption
func WithServerClusterFailFast ¶
func WithServerClusterFailFast() ServerOption
func WithServerClusterFailOver ¶
func WithServerClusterFailOver() ServerOption
func WithServerClusterFailSafe ¶
func WithServerClusterFailSafe() ServerOption
func WithServerClusterForking ¶
func WithServerClusterForking() ServerOption
func WithServerClusterZoneAware ¶
func WithServerClusterZoneAware() ServerOption
func WithServerExecuteLimit ¶
func WithServerExecuteLimit(exeLimit string) ServerOption
func WithServerExecuteLimitRejectedHandler ¶
func WithServerExecuteLimitRejectedHandler(exeRejHandler string) ServerOption
func WithServerFilter ¶
func WithServerFilter(filter string) ServerOption
todo(DMwangnima): change Filter Option like Cluster and LoadBalance
func WithServerFilterConf ¶
func WithServerFilterConf(conf interface{}) ServerOption
todo(DMwangnima): this configuration would be used by filter/hystrix think about a more ideal way to configure
func WithServerGroup ¶
func WithServerGroup(group string) ServerOption
func WithServerJSON ¶
func WithServerJSON() ServerOption
func WithServerLoadBalance ¶
func WithServerLoadBalance(lb string) ServerOption
func WithServerLoadBalanceConsistentHashing ¶
func WithServerLoadBalanceConsistentHashing() ServerOption
func WithServerLoadBalanceLeastActive ¶
func WithServerLoadBalanceLeastActive() ServerOption
func WithServerLoadBalanceP2C ¶
func WithServerLoadBalanceP2C() ServerOption
func WithServerLoadBalanceRandom ¶
func WithServerLoadBalanceRandom() ServerOption
func WithServerLoadBalanceRoundRobin ¶
func WithServerLoadBalanceRoundRobin() ServerOption
func WithServerNotRegister ¶
func WithServerNotRegister() ServerOption
func WithServerParam ¶
func WithServerParam(k, v string) ServerOption
func WithServerParamSign ¶
func WithServerParamSign(paramSign string) ServerOption
func WithServerProtocol ¶
func WithServerProtocol(opts ...protocol.Option) ServerOption
func WithServerProtocolIDs ¶
func WithServerProtocolIDs(protocolIDs []string) ServerOption
todo(DMwangnima): think about a more ideal configuration style
func WithServerRegistry ¶
func WithServerRegistry(opts ...registry.Option) ServerOption
func WithServerRegistryIDs ¶
func WithServerRegistryIDs(registryIDs []string) ServerOption
todo(DMwangnima): think about a more ideal configuration style
func WithServerRetries ¶
func WithServerRetries(retries int) ServerOption
func WithServerSerialization ¶
func WithServerSerialization(ser string) ServerOption
func WithServerTag ¶
func WithServerTag(tag string) ServerOption
func WithServerToken ¶
func WithServerToken(token string) ServerOption
WithToken should be used with WithFilter("token")
func WithServerTpsLimitRate ¶
func WithServerTpsLimitRate(rate int) ServerOption
func WithServerTpsLimitRejectedHandler ¶
func WithServerTpsLimitRejectedHandler(rejHandler string) ServerOption
func WithServerTpsLimitStrategy ¶
func WithServerTpsLimitStrategy(strategy string) ServerOption
func WithServerTpsLimiter ¶
func WithServerTpsLimiter(limiter string) ServerOption
func WithServerVersion ¶
func WithServerVersion(version string) ServerOption
func WithServerWarmUp ¶
func WithServerWarmUp(warmUp time.Duration) ServerOption
warmUp is in seconds
func WithServerWarmup ¶
func WithServerWarmup(milliSeconds time.Duration) ServerOption
type ServerOptions ¶
type ServerOptions struct { Provider *global.ProviderConfig Application *global.ApplicationConfig Registries map[string]*global.RegistryConfig Protocols map[string]*global.ProtocolConfig Shutdown *global.ShutdownConfig Metrics *global.MetricsConfig Otel *global.OtelConfig // contains filtered or unexported fields }
type ServiceDefinition ¶
type ServiceDefinition struct { Handler interface{} Info *ServiceInfo Opts []ServiceOption }
type ServiceInfo ¶
type ServiceInfo struct { InterfaceName string ServiceType interface{} Methods []MethodInfo Meta map[string]interface{} }
ServiceInfo is meta info of a service
type ServiceOption ¶
type ServiceOption func(*ServiceOptions)
func SetApplication ¶
func SetApplication(application *global.ApplicationConfig) ServiceOption
func SetProtocols ¶
func SetProtocols(pros map[string]*global.ProtocolConfig) ServiceOption
func SetProvider ¶
func SetProvider(provider *global.ProviderConfig) ServiceOption
func SetRegistries ¶
func SetRegistries(regs map[string]*global.RegistryConfig) ServiceOption
func SetService ¶
func SetService(service *global.ServiceConfig) ServiceOption
func WithAccesslog ¶
func WithAccesslog(accesslog string) ServiceOption
func WithAuth ¶
func WithAuth(auth string) ServiceOption
func WithCluster ¶
func WithCluster(cluster string) ServiceOption
func WithClusterAdaptiveService ¶
func WithClusterAdaptiveService() ServiceOption
func WithClusterAvailable ¶
func WithClusterAvailable() ServiceOption
func WithClusterBroadcast ¶
func WithClusterBroadcast() ServiceOption
func WithClusterFailBack ¶
func WithClusterFailBack() ServiceOption
func WithClusterFailFast ¶
func WithClusterFailFast() ServiceOption
func WithClusterFailOver ¶
func WithClusterFailOver() ServiceOption
func WithClusterFailSafe ¶
func WithClusterFailSafe() ServiceOption
func WithClusterForking ¶
func WithClusterForking() ServiceOption
func WithClusterZoneAware ¶
func WithClusterZoneAware() ServiceOption
func WithExecuteLimit ¶
func WithExecuteLimit(exeLimit string) ServiceOption
func WithExecuteLimitRejectedHandler ¶
func WithExecuteLimitRejectedHandler(exeRejHandler string) ServiceOption
func WithFilter ¶
func WithFilter(filter string) ServiceOption
todo(DMwangnima): change Filter Option like Cluster and LoadBalance
func WithGroup ¶
func WithGroup(group string) ServiceOption
func WithInterface ¶
func WithInterface(intf string) ServiceOption
func WithJSON ¶
func WithJSON() ServiceOption
func WithLoadBalance ¶
func WithLoadBalance(lb string) ServiceOption
func WithLoadBalanceConsistentHashing ¶
func WithLoadBalanceConsistentHashing() ServiceOption
func WithLoadBalanceLeastActive ¶
func WithLoadBalanceLeastActive() ServiceOption
func WithLoadBalanceP2C ¶
func WithLoadBalanceP2C() ServiceOption
func WithLoadBalanceRandom ¶
func WithLoadBalanceRandom() ServiceOption
func WithLoadBalanceRoundRobin ¶
func WithLoadBalanceRoundRobin() ServiceOption
func WithMethod ¶
func WithMethod(opts ...config.MethodOption) ServiceOption
func WithNotRegister ¶
func WithNotRegister() ServiceOption
func WithParam ¶
func WithParam(k, v string) ServiceOption
func WithParamSign ¶
func WithParamSign(paramSign string) ServiceOption
func WithProtocol ¶
func WithProtocol(opts ...protocol.Option) ServiceOption
func WithProtocolIDs ¶
func WithProtocolIDs(protocolIDs []string) ServiceOption
todo(DMwangnima): think about a more ideal configuration style
func WithRegistry ¶
func WithRegistry(opts ...registry.Option) ServiceOption
func WithRegistryIDs ¶
func WithRegistryIDs(registryIDs []string) ServiceOption
todo(DMwangnima): think about a more ideal configuration style
func WithRetries ¶
func WithRetries(retries int) ServiceOption
func WithSerialization ¶
func WithSerialization(ser string) ServiceOption
func WithTag ¶
func WithTag(tag string) ServiceOption
func WithToken ¶
func WithToken(token string) ServiceOption
WithToken should be used with WithFilter("token")
func WithTpsLimitRate ¶
func WithTpsLimitRate(rate int) ServiceOption
func WithTpsLimitRejectedHandler ¶
func WithTpsLimitRejectedHandler(rejHandler string) ServiceOption
func WithTpsLimitStrategy ¶
func WithTpsLimitStrategy(strategy string) ServiceOption
func WithTpsLimiter ¶
func WithTpsLimiter(limiter string) ServiceOption
func WithVersion ¶
func WithVersion(version string) ServiceOption
func WithWarmup ¶
func WithWarmup(milliSeconds time.Duration) ServiceOption
type ServiceOptions ¶
type ServiceOptions struct { Application *global.ApplicationConfig Provider *global.ProviderConfig Service *global.ServiceConfig Registries map[string]*global.RegistryConfig Protocols map[string]*global.ProtocolConfig Id string ProxyFactoryKey string // contains filtered or unexported fields }
func (*ServiceOptions) ExportWithInfo ¶
func (svcOpts *ServiceOptions) ExportWithInfo(info *ServiceInfo) error
func (*ServiceOptions) ExportWithoutInfo ¶
func (svcOpts *ServiceOptions) ExportWithoutInfo() error
func (*ServiceOptions) GetExportedUrls ¶
func (svcOpts *ServiceOptions) GetExportedUrls() []*common.URL
GetExportedUrls will return the url in service config's exporter
func (*ServiceOptions) Implement ¶
func (svcOpts *ServiceOptions) Implement(rpcService common.RPCService)
Implement only store the @s and return
func (*ServiceOptions) InitExported ¶
func (svcOpts *ServiceOptions) InitExported()
InitExported will set exported as false atom bool
func (*ServiceOptions) IsExport ¶
func (svcOpts *ServiceOptions) IsExport() bool
IsExport will return whether the service config is exported or not
func (*ServiceOptions) Prefix ¶
func (svcOpts *ServiceOptions) Prefix() string
Prefix returns dubbo.service.${InterfaceName}.
func (*ServiceOptions) Unexport ¶
func (svcOpts *ServiceOptions) Unexport()
Unexport will call unexport of all exporters service config exported