consulapi

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: 7 Imported by: 0

Documentation

Overview

Package consulapi for process cousul

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConsulWatchKeyNotExist = errors.New("watch Key dos not exist")
	ErrConsulWatchExit        = errors.New("watch exit")
)

Functions

func ConsulGlobalLock

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

ConsulGlobalLock 获得全局锁 client: consul api对象 lockName: 锁名字 waitLockTime: 得到锁的等待时间,如果超时都没有获得,返回报错 "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

ConsulWatchKey 对一个key的监控

func NewConsulClient

func NewConsulClient(consulIP string) (*api.Client, 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)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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