service

package
v4.1.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2017 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HEARTBEAT_DURATION = 5
)

Variables

This section is empty.

Functions

func Client

func Client() etcd.Client

func IsKeyAlreadyExistError

func IsKeyAlreadyExistError(err error) bool

func KAPI

func KAPI() etcd.KeysAPI

func Register

func Register(service string, host *Host, infos *Infos, stop chan struct{}) (chan struct{}, error)

func Subscribe

func Subscribe(service string) etcd.Watcher

func SubscribeDown

func SubscribeDown(service string) (<-chan string, <-chan *etcd.Error)

func SubscribeNew

func SubscribeNew(service string) (<-chan *Host, <-chan *etcd.Error)

func SubscribeUpdate

func SubscribeUpdate(service string) (<-chan *Host, <-chan *etcd.Error)

Types

type Host

type Host struct {
	Name     string `json:"name"`
	Ports    Ports  `json:"ports"`
	User     string `json:"user,omitempty"`
	Password string `json:"password,omitempty"`
}

func NewHost

func NewHost(hostname string, ports Ports, params ...string) (*Host, error)

func (*Host) Url

func (h *Host) Url(scheme, path string) (string, error)

type Hosts

type Hosts []*Host

func (Hosts) String

func (hs Hosts) String() string

type Infos

type Infos struct {
	Name     string `json:"name"`
	Critical bool   `json:"critical"` // Is the service critical to the infrastructure health?
}

type Ports

type Ports map[string]string

type Service

type Service struct {
	Infos *Infos
	Hosts Hosts
}

func Get

func Get(service string) (*Service, error)

Jump to

Keyboard shortcuts

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