service

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorNeedUpstream = errors.New("need upstream")

	ErrorInvalidDiscovery = errors.New("invalid Discovery")
)
View Source
var DriverName = "service_http"

Functions

func Create added in v0.9.0

func Create(id, name string, v *Config, workers map[eosc.RequireId]eosc.IWorker) (eosc.IWorker, error)

Create 创建service_http驱动的实例

func NewFactory

func NewFactory() eosc.IExtenderDriverFactory

NewFactory 创建service_http驱动工厂

func Register

func Register(register eosc.IExtenderDriverRegister)

Register 注册service_http驱动工厂

Types

type Config

type Config struct {
	Timeout      int64          `json:"timeout" label:"请求超时时间" default:"2000" minimum:"1" description:"单位:ms,最小值:1"`
	Retry        int            `json:"retry" label:"失败重试次数"`
	Scheme       string         `json:"scheme" label:"请求协议" enum:"HTTP,HTTPS"`
	Discovery    eosc.RequireId `` /* 153-byte string literal not displayed */
	Service      string         `json:"service" required:"false" label:"服务名 or 配置" switch:"discovery !==''"`
	Nodes        []string       `json:"nodes" label:"静态配置" switch:"discovery===''"`
	Balance      string         `json:"balance" enum:"round-robin,ip-hash" label:"负载均衡算法"`
	PassHost     string         `` /* 251-byte string literal not displayed */
	UpstreamHost string         `` /* 163-byte string literal not displayed */
}

Config service_http驱动配置

func (*Config) String

func (c *Config) String() string

type Service

type Service struct {
	eocontext.BalanceHandler
	// contains filtered or unexported fields
}

func (*Service) Nodes

func (s *Service) Nodes() []eocontext.INode

func (*Service) PassHost

func (s *Service) PassHost() (eocontext.PassHostMod, string)

func (*Service) Reset

func (s *Service) Reset(conf interface{}, workers map[eosc.RequireId]eosc.IWorker) error

Reset 重置服务实例的配置

func (*Service) Scheme

func (s *Service) Scheme() string

func (*Service) TimeOut

func (s *Service) TimeOut() time.Duration

Jump to

Keyboard shortcuts

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