discovery

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckResponse added in v0.2.1

type CheckResponse struct {
	Url string

	RetryCount int
	// contains filtered or unexported fields
}

func (*CheckResponse) GetOnTime added in v0.2.1

func (r *CheckResponse) GetOnTime() int64

func (*CheckResponse) Result added in v0.2.1

func (r *CheckResponse) Result() string

func (*CheckResponse) SetHealthy added in v0.2.1

func (r *CheckResponse) SetHealthy(healthy string)

type Config

type Config struct {
	Id                 string
	Name               string
	RegisterAddr       string
	RegisterPort       int
	CheckAddr          string
	CheckPort          int
	Tags               []string
	IntervalTime       int // 健康检查间隔
	DeregisterTime     int //check失败后30秒删除本服务,注销时间,相当于过期时间
	TimeOut            int
	CheckHTTP          string
	HttpRouter         HttpRouter
	CheckHealthyStatus bool
	CheckResponse      *CheckResponse
}

type Discovery

type Discovery interface {
	Register() error
	Deregister() error
}

type HttpRouter added in v0.2.1

type HttpRouter func(r *CheckResponse)

type KV

type KV interface {
	Get(key string) ([]byte, error)
	Set(key string, value string) error
	Delete(key string) error
	List(key string) (map[string][]byte, error)
}

type Option

type Option func(*Config)

Option for queue system

func WithCheckAddr added in v0.2.1

func WithCheckAddr(addr string) Option

WithCheckAddr set addr function

func WithCheckHTTP

func WithCheckHTTP(router HttpRouter, checkHttp ...string) Option

WithCheckHTTP set checkHttp function r.GET(url, func(c *gin.Context) { c.String(200, "Healthy") })

func WithCheckPort added in v0.2.1

func WithCheckPort(port int) Option

WithCheckPort set port function

func WithDeregisterTime

func WithDeregisterTime(deregisterTime int) Option

WithDeregisterTime set deregisterTime function

func WithEnableHealthyStatus added in v0.2.1

func WithEnableHealthyStatus() Option

WithEnableHealthyStatus checkHealthyStatus function

func WithId

func WithId(id string) Option

WithId set id function

func WithIntervalTime

func WithIntervalTime(intervalTime int) Option

WithIntervalTime set intervalTime function

func WithName added in v0.2.1

func WithName(name string) Option

WithName set name function

func WithRegisterAddr added in v0.2.1

func WithRegisterAddr(addr string) Option

WithRegisterAddr set addr function

func WithRegisterPort added in v0.2.1

func WithRegisterPort(port int) Option

WithRegisterPort set port function

func WithTags

func WithTags(tags ...string) Option

WithTags set tags function

func WithTimeOut

func WithTimeOut(timeOut int) Option

WithTimeOut set timeOut function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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