server

package
v0.11.15 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigInfo added in v0.2.0

type ConfigInfo struct {
	Routes []Route
}

ConfigInfo ServiceConfigurator represents service configurator

type Option added in v0.2.0

type Option func(c *ServiceInfo)

func WithAddress added in v0.2.0

func WithAddress(address string) Option

func WithKind added in v0.2.0

func WithKind(kind constant.ServiceKind) Option

func WithMetaData added in v0.2.0

func WithMetaData(key, value string) Option

func WithScheme added in v0.2.0

func WithScheme(scheme string) Option

type Route added in v0.2.0

type Route struct {
	// 权重组,按照
	WeightGroups []WeightGroup
	// 方法名
	Method string
}

Route ...

type Server

type Server interface {
	Serve() error
	Stop() error
	GracefulStop(ctx context.Context) error
	Info() *ServiceInfo
	Healthz() bool
}

Server ...

type ServiceInfo

type ServiceInfo struct {
	Name     string               `json:"name"`
	AppID    string               `json:"appId"`
	Scheme   string               `json:"scheme"`
	Address  string               `json:"address"`
	Weight   float64              `json:"weight"`
	Enable   bool                 `json:"enable"`
	Healthy  bool                 `json:"healthy"`
	Metadata map[string]string    `json:"metadata"`
	Region   string               `json:"region"`
	Zone     string               `json:"zone"`
	Kind     constant.ServiceKind `json:"kind"`
	Version  string               `json:"version"`
	Mode     string               `json:"mode"`
	Hostname string               `json:"hostname"`
	// Deployment 部署组: 不同组的流量隔离
	// 比如某些服务给内部调用和第三方调用,可以配置不同的deployment,进行流量隔离
	Deployment string `json:"deployment"`
	// Group 流量组: 流量在Group之间进行负载均衡
	Group string `json:"group"`
}

ServiceInfo represents service info

func ApplyOptions added in v0.2.0

func ApplyOptions(options ...Option) ServiceInfo

func (ServiceInfo) Equal added in v0.4.3

func (si ServiceInfo) Equal(o interface{}) bool

Equal allows the values to be compared by Attributes.Equal, this change is in order to fit the change in grpc-go: attributes: add Equal method; resolver: add AddressMap and State.BalancerAttributes (#4855)

func (ServiceInfo) Label

func (si ServiceInfo) Label() string

Label ...

func (*ServiceInfo) RegistryName added in v0.8.0

func (s *ServiceInfo) RegistryName() string

RegistryName returns the registry name of the service

func (*ServiceInfo) ServicePrefix added in v0.8.0

func (s *ServiceInfo) ServicePrefix() string

type WeightGroup added in v0.2.0

type WeightGroup struct {
	Group  string
	Weight int
}

WeightGroup ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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