discovery

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 17, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Id                  string
	ServiceName         string
	ServiceRegisterAddr string
	ServiceRegisterPort int
	ServiceCheckAddr    string
	ServiceCheckPort    int
	Tags                []string
	IntervalTime        int // 健康检查间隔
	DeregisterTime      int //check失败后30秒删除本服务,注销时间,相当于过期时间
	TimeOut             int
	CheckHTTP           string
	Router              Router
}

type Discovery

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

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 WithCheckHTTP

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

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

func WithDeregisterTime

func WithDeregisterTime(deregisterTime int) Option

WithDeregisterTime set deregisterTime function

func WithId

func WithId(id string) Option

WithId set id function

func WithIntervalTime

func WithIntervalTime(intervalTime int) Option

WithIntervalTime set intervalTime function

func WithServiceCheckAddr

func WithServiceCheckAddr(serviceCheckAddr string) Option

WithServiceCheckAddr set serviceCheckAddr function

func WithServiceCheckPort

func WithServiceCheckPort(serviceCheckPort int) Option

WithServiceCheckPort set serviceCheckPort function

func WithServiceName

func WithServiceName(serviceName string) Option

WithServiceName set serviceName function

func WithServiceRegisterAddr

func WithServiceRegisterAddr(serviceRegisterAddr string) Option

WithServiceRegisterAddr set serviceRegisterAddr function

func WithServiceRegisterPort

func WithServiceRegisterPort(serviceRegisterPort int) Option

WithServiceRegisterPort set serviceRegisterPort function

func WithTags

func WithTags(tags ...string) Option

WithTags set tags function

func WithTimeOut

func WithTimeOut(timeOut int) Option

WithTimeOut set timeOut function

type Router

type Router func(url string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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