xregistry

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

* * @Author: myxy99 <myxy99@foxmail.com> * @Date: 2021/1/1 22:04

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeyFormat

func KeyFormat(target resolver.Target) string

func UpdateAddress

func UpdateAddress(i []Instance, conn resolver.ClientConn)

Types

type Discovery

type Discovery interface {
	Discover(target string) (<-chan []Instance, error)
	Close()
}

服务发现接口

type Instance

type Instance struct {
	ServiceName string            `json:"servicename"`
	Address     string            `json:"address"`
	Metadata    map[string]string `json:"metadata"`
}

type NoopResolver

type NoopResolver struct{}

func (*NoopResolver) Close

func (r *NoopResolver) Close()

func (*NoopResolver) ResolveNow

func (r *NoopResolver) ResolveNow(resolver.ResolveNowOptions)

type Option

type Option func(*Options)

func Address

func Address(address string) Option

func Metadata

func Metadata(m map[string]string) Option

func RegisterInterval

func RegisterInterval(interval time.Duration) Option

func RegisterTTL

func RegisterTTL(ttl time.Duration) Option

func ServiceName

func ServiceName(name string) Option

func ServiceNamespaces

func ServiceNamespaces(namespaces string) Option

type Options

type Options struct {
	ServiceName string            `json:"servicename"`
	Namespaces  string            `json:"namespaces"`
	Address     string            `json:"address"`
	Metadata    map[string]string `json:"metadata"`
	// 服务有效时长
	RegisterTTL      time.Duration `json:"-"` // time to live, 服务失活一段时间后自动从注册中心删除
	RegisterInterval time.Duration `json:"-"` // 注册间隔时长,也可不要 默认为RegisterTTL/3
}

Registry Options

type Registry

type Registry interface {
	Register(ops ...Option)
	Close()
}

Directories

Path Synopsis
* * @Author: myxy99 <myxy99@foxmail.com> * @Date: 2021/1/1 22:44 * * @Author: myxy99 <myxy99@foxmail.com> * @Date: 2021/1/1 22:44
* * @Author: myxy99 <myxy99@foxmail.com> * @Date: 2021/1/1 22:44 * * @Author: myxy99 <myxy99@foxmail.com> * @Date: 2021/1/1 22:44
* * @Author: myxy99 <myxy99@foxmail.com> * @Date: 2021/1/1 22:20 * * @Author: myxy99 <myxy99@foxmail.com> * @Date: 2021/1/1 22:34 * * @Author: myxy99 <myxy99@foxmail.com> * @Date: 2021/1/1 22:21
* * @Author: myxy99 <myxy99@foxmail.com> * @Date: 2021/1/1 22:20 * * @Author: myxy99 <myxy99@foxmail.com> * @Date: 2021/1/1 22:34 * * @Author: myxy99 <myxy99@foxmail.com> * @Date: 2021/1/1 22:21
* * @Author: myxy99 <myxy99@foxmail.com> * @Date: 2021/1/1 22:08 * * @Author: myxy99 <myxy99@foxmail.com> * @Date: 2021/1/1 22:12
* * @Author: myxy99 <myxy99@foxmail.com> * @Date: 2021/1/1 22:08 * * @Author: myxy99 <myxy99@foxmail.com> * @Date: 2021/1/1 22:12

Jump to

Keyboard shortcuts

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