registry

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultRegistry = NewRegistry()
)

Functions

func NewRegistry

func NewRegistry(opts ...Option) *registry

NewRegistry function

Types

type Node

type Node struct {
	ID string `json:"id"`
}

type Option

type Option func(*Options)

func Addrs

func Addrs(addrs ...string) Option

Addrs is the registry addresses to use

func Checks

func Checks(checks ...*consul.AgentServiceCheck) Option

specify consul Agent check args

func Timeout

func Timeout(t time.Duration) Option

type Options

type Options struct {
	//registry options
	Addrs   []string
	Timeout time.Duration

	//consul agent check options
	Checks consul.AgentServiceChecks
}

type Registry

type Registry interface {
	Init() error
	Register(*Service) error
	Deregister(*Service) error
	GetService(string) ([]*Service, error)
	ListServices() ([]*Service, error)
	Options() Options
	Client() *consul.Client
}

type Service

type Service struct {
	Name    string  `json:"name"`
	Version string  `json:"version"`
	Nodes   []*Node `json:"nodes"`
}

Service struct

Jump to

Keyboard shortcuts

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