consul

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

@author: mongo

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitResolver

func InitResolver(host string, port int, token string, serviceName string)

InitResolver returns

func NewBuilder

func NewBuilder(h string, p int, t string, sn string) resolver.Builder

NewBuilder ...

Types

type Resource

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

ConsulResource defines resource

func New

func New(cfg *discovery.ServerConfig) (*Resource, error)

@todo 讲依赖声明加到初始化的地方 New returns the point of ConsulResource

func (*Resource) ClaimServices

func (cr *Resource) ClaimServices(dependServices []string) bool

ClaimServices 声明依赖的服务

func (*Resource) DeregisterService

func (cr *Resource) DeregisterService() error

DeregisterService sign off from consul by defined serviceID

func (Resource) Dial

func (cr Resource) Dial(service string) (*grpc.ClientConn, error)

@todo 设置成单例子?看 gRPC client 代码实现是否处理过了。 DialService sign off from consul by defined serviceID

func (*Resource) RegisterService

func (cr *Resource) RegisterService() error

RegisterService 注册服务

func (*Resource) WithServiceConfig

func (cr *Resource) WithServiceConfig(cfg *discovery.ServiceConfig)

Jump to

Keyboard shortcuts

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