consul

package
v0.0.0-...-cfef848 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenUpdates

func GenUpdates(a, b []string) []*naming.Update

func Register

func Register(name string, host string, port int, target string, interval time.Duration, ttl int) error

Register is the helper function to self-register service into Etcd/Consul server name - service name host - service host port - service port target - consul dial address, for example: "127.0.0.1:8500" interval - interval of self-register to etcd ttl - ttl of the register information

Types

type ConsulResolver

type ConsulResolver struct {
	ServiceName string //service name
}

ConsulResolver is the implementaion of grpc.naming.Resolver

func NewResolver

func NewResolver(serviceName string) *ConsulResolver

NewResolver return ConsulResolver with service name

func (*ConsulResolver) Resolve

func (cr *ConsulResolver) Resolve(target string) (naming.Watcher, error)

Resolve to resolve the service from consul, target is the dial address of consul

type ConsulWatcher

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

ConsulWatcher is the implementation of grpc.naming.Watcher

func (*ConsulWatcher) Close

func (cw *ConsulWatcher) Close()

Close do nonthing

func (*ConsulWatcher) Next

func (cw *ConsulWatcher) Next() ([]*naming.Update, error)

Next to return the updates

Jump to

Keyboard shortcuts

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