services

package module
v0.0.0-...-040153f Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: MIT Imports: 10 Imported by: 0

README

#services a drop-in services discovery library based on etcd

pb.go产生方式

protoc ./*.proto --go_out=plugins=grpc:./

#etcd目录结构 etcd目录结构采用 http://gliderlabs.com/registrator/latest/ 提供的结构:

/backends/service_xxx/service_id ---> ip:port

调用 Init(..) 将服务发现限定在给定范围

services

Documentation

Index

Constants

View Source
const (
	DEFAULT_TIMEOUT = 5 * time.Second
	DEFAULT_RETRIES = 6 // failed connection retries (for every ten seconds)
)

Variables

This section is empty.

Functions

func AllService

func AllService(path string) map[string]*grpc.ClientConn

func GetService

func GetService(path string) (*grpc.ClientConn, string)

/////////////////////////////////////////////////////////////// Wrappers

func GetServiceWithHash

func GetServiceWithHash(path string, value int) (*grpc.ClientConn, string)

func GetServiceWithId

func GetServiceWithId(path string, id string) *grpc.ClientConn

func Init

func Init(root string, hosts, names []string)

Init() ***MUST*** be called before using

func RegisterCallback

func RegisterCallback(path string, callback chan string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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