hi

package module
v0.0.0-...-085eba2 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2018 License: MIT Imports: 8 Imported by: 5

README

hi

A implement of Resolver for gRPC , which achieve Register and Discovery base on etcd .

hi 实现在 etcd 中维护各微服务的地址注册,注册格式为:

key ==> 微服务名/ip:port

value ==> ip:port

每个微服务在 startup 时注册其 微服务名&地址

最终的结果类似如下例子:

/hi/order/1.2.3.4:8000 ===> 1.2.3.4:8000

/hi/order/1.2.3.4:8001 ===> 1.2.3.4:8001

当 gRPC 发请求的时候,会根据负载算法从 server list 中取出一个来发送 request

Documentation

Index

Constants

View Source
const (
	DefaultScheme = "hi"
)

Variables

This section is empty.

Functions

func NewHi

func NewHi(endpoints []string, scheme string) hi

NewHi create a Hi instance

Types

type Builder

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

Implement resolver.Builder

func NewResolverBuilder

func NewResolverBuilder(etcdEndPoints []string) Builder

func (*Builder) Build

func (*Builder) Scheme

func (b *Builder) Scheme() string

type Resolver

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

Implement resolver.Resolver

func (*Resolver) Close

func (r *Resolver) Close()

func (*Resolver) ResolveNow

func (r *Resolver) ResolveNow(opt resolver.ResolveNowOption)

Directories

Path Synopsis
example
pb

Jump to

Keyboard shortcuts

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