consul_api

package
v0.0.0-...-b988991 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

* @Author: calmwu * @Date: 2017-11-21 14:52:04 * @Last Modified by: calmwu * @Last Modified time: 2017-11-21 17:27:18 * @Comment:

Index

Constants

This section is empty.

Variables

View Source
var (
	ConsulWatchKeyNotExist = errors.New("Watch Key dos not exist")
	ConsulWatchExit        = errors.New("Watch exit")
)

Functions

func ConsulGlobalLock

func ConsulGlobalLock(client *api.Client, lockName string, watiLockTime string) (*api.Lock, error)

client: consul api对象 lockName: 锁名字 watiLockTime: 得到锁的等待时间,如果超时都没有获得,返回报错 "10s" "100ms",永久等待就用""

func ConsulGlobalSeq

func ConsulGlobalSeq(client *api.Client, seqName string, initSeqNum int, waitTime string) (int, error)

func ConsulSvrReg

func ConsulSvrReg(client *api.Client, servName string, servTags []string, servInstName string,
	servInstListenIP string, servInstListenPort int, healthCheckUrl string) error

func ConsulWatchKey

func ConsulWatchKey(client *api.Client, keyName string, stopCh chan struct{}, notifyCh chan interface{}) error

对一个key的监控

func NewConsulClient

func NewConsulClient(consulIP string) (*api.Client, error)

func PostBaseRequstByConsulDns

func PostBaseRequstByConsulDns(interfaceName string, req *base.ProtoRequestS, client *api.Client, svrName string) (*base.ProtoResponseS, error)

func PostRequstByConsulDns

func PostRequstByConsulDns(uin uint64, interfaceName string, realReq interface{}, client *api.Client, svrName string) (*base.ProtoResponseS, error)

func ReleaseGlobalLock

func ReleaseGlobalLock(lock *api.Lock) error

Types

type ConsulServInstS

type ConsulServInstS struct {
	ID   string
	IP   string
	Port int
}

func ConsulServDns

func ConsulServDns(client *api.Client, servName string) ([]*ConsulServInstS, error)

通过服务名,获取健康的服务实例列表

Jump to

Keyboard shortcuts

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