service_http

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: Apache-2.0 Imports: 20 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 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" label:"负载均衡算法"`
	PluginConfig map[string]*plugin.Config `json:"plugins" label:"插件"`
}

Config service_http驱动配置

func (*Config) String added in v0.6.2

func (c *Config) String() string

type Handlers

type Handlers struct {
	// contains filtered or unexported fields
}

func NewHandlers

func NewHandlers() *Handlers

func (*Handlers) Del

func (h *Handlers) Del(id string) (*ServiceHandler, bool)

func (*Handlers) List

func (h *Handlers) List() []*ServiceHandler

func (*Handlers) Set

func (h *Handlers) Set(id string, handler *ServiceHandler)

type IHandlers

type IHandlers interface {
	Set(id string, handler *ServiceHandler)
	Del(id string) (*ServiceHandler, bool)
	List() []*ServiceHandler
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func (*Service) Create

func (s *Service) Create(id string, configs map[string]*plugin.Config) service.IService

func (*Service) Merge

func (s *Service) Merge(config map[string]*plugin.Config) map[string]*plugin.Config

type ServiceHandler

type ServiceHandler struct {
	// contains filtered or unexported fields
}

func (*ServiceHandler) Destroy

func (s *ServiceHandler) Destroy()

func (*ServiceHandler) DoChain

func (*ServiceHandler) DoFilter

func (s *ServiceHandler) DoFilter(ctx http_service.IHttpContext, next http_service.IChain) (err error)

type Upstream added in v0.6.2

type Upstream struct {
	// contains filtered or unexported fields
}

func NewUpstream added in v0.6.2

func NewUpstream(scheme string, app discovery.IApp, handler balance.IBalanceHandler) *Upstream

func (*Upstream) Create added in v0.6.2

func (up *Upstream) Create(id string, retry int, timeout time.Duration) (upstream.IUpstreamHandler, error)

func (*Upstream) Reset added in v0.6.2

func (up *Upstream) Reset(scheme string, app discovery.IApp, handler balance.IBalanceHandler)

Reset reset

type UpstreamHandler added in v0.6.2

type UpstreamHandler struct {
	// contains filtered or unexported fields
}

func NewUpstreamHandler added in v0.6.2

func NewUpstreamHandler(id string, upstream *Upstream, retry int, timeout time.Duration) *UpstreamHandler

func (*UpstreamHandler) Destroy added in v0.6.2

func (u *UpstreamHandler) Destroy()

func (*UpstreamHandler) DoChain added in v0.6.2

DoChain 请求发送

Jump to

Keyboard shortcuts

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