Documentation ¶
Index ¶
- func DoCheckRegister(cr CheckRegister, addr string, c *Check) error
- func DoCheckUnregister(cr CheckRegister, addr, checkID string) error
- func DoServiceRegister(sr ServiceRegister, addr string, s *Service) error
- func DoServiceUnregister(sr ServiceRegister, addr, serviceID string) error
- func GetServiceTargets(addr, serviceID string) (targets []string, err error)
- func GetStatus(l Leader, addr string) (string, error)
- type Check
- type CheckRegister
- type Checker
- type Checks
- type Config
- type ConfigFunc
- type DefaultCheckRegister
- type DefaultChecker
- type DefaultLeader
- type DefaultNoder
- type DefaultServiceNoder
- type DefaultServiceRegister
- type DefaultServicer
- type Discovery
- type Leader
- type Node
- type Noder
- type Nodes
- type Service
- type ServiceNode
- type ServiceNoder
- type ServiceNodes
- type ServiceRegister
- type Servicer
- type Services
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoCheckRegister ¶
func DoCheckRegister(cr CheckRegister, addr string, c *Check) error
DoCheckRegister function to register a new check
func DoCheckUnregister ¶
func DoCheckUnregister(cr CheckRegister, addr, checkID string) error
DoCheckUnregister function to unregister a check by ID
func DoServiceRegister ¶
func DoServiceRegister(sr ServiceRegister, addr string, s *Service) error
DoServiceRegister function to register a new service
func DoServiceUnregister ¶
func DoServiceUnregister(sr ServiceRegister, addr, serviceID string) error
DoServiceUnregister function to unregister a service by ID
func GetServiceTargets ¶
GetServiceTargets create a slice of addresses based on the services returned from CatalogService
Types ¶
type Check ¶
type Check struct { ID string `json:"ID,omitempty"` CheckID string `json:"CheckID,omitempty"` Name string `json:"Name"` Node string `json:"Node,omitempty"` Notes string `json:"Notes,omitempty"` DeregisterCriticalServiceAfter string `json:"DeregisterCriticalServiceAfter,omitempty"` Script string `json:"Script,omitempty"` DockerContainerID string `json:"DockerContainerID,omitempty"` Shell string `json:"Shell,omitempty"` HTTP string `json:"HTTP,omitempty"` TCP string `json:"TCP,omitempty"` Interval string `json:"Interval,omitempty"` TTL string `json:"TTL,omitempty"` Timeout string `json:"Timeout,omitempty"` ServiceID string `json:"ServiceID,omitempty"` Status string `json:"Status,omitempty"` }
Check struct
type CheckRegister ¶
type CheckRegister interface { Register(addr, path string, c *Check) error Unregister(addr, path, checkID string) error }
CheckRegister interface
type Config ¶
type Config struct { Addr string // Services []*Service Services Services // Checks []*Check Checks Checks }
Config pluto service config
type DefaultCheckRegister ¶
type DefaultCheckRegister struct{}
DefaultCheckRegister struct to implement CheckRegister default methods
func (*DefaultCheckRegister) Register ¶
func (dr *DefaultCheckRegister) Register(addr, path string, c *Check) error
Register make PUT request on consul api
func (*DefaultCheckRegister) Unregister ¶
func (dr *DefaultCheckRegister) Unregister(addr, path, checkID string) error
Unregister make PUT request on consul api
type DefaultChecker ¶
type DefaultChecker struct{}
DefaultChecker struct to implement Checker default methods
type DefaultServiceNoder ¶
type DefaultServiceNoder struct{}
DefaultServiceNoder struct to append GetNodeServices
func (*DefaultServiceNoder) GetServiceNodes ¶
func (dn *DefaultServiceNoder) GetServiceNodes(addr, path, serviceID string) (ServiceNodes, error)
GetServiceNodes make GET request on consul api
type DefaultServiceRegister ¶
type DefaultServiceRegister struct{}
DefaultServiceRegister struct to implement Register default methods
func (*DefaultServiceRegister) Register ¶
func (dr *DefaultServiceRegister) Register(addr, path string, s *Service) error
Register make PUT request on consul api
func (*DefaultServiceRegister) Unregister ¶
func (dr *DefaultServiceRegister) Unregister(addr, path, serviceID string) error
Unregister make PUT request on consul api
type DefaultServicer ¶
type DefaultServicer struct{}
DefaultServicer struct to implement Servicer default methods
func (*DefaultServicer) GetServices ¶
func (ds *DefaultServicer) GetServices(addr, path string) (Services, error)
GetServices make GET request on consul api
type Discovery ¶
type Discovery interface { IsAvailable() (bool, error) Service(string) ([]string, error) Register(...ConfigFunc) error Unregister() error }
Discovery ...
type Node ¶
type Node struct { Node string `json:"Node"` Address string `json:"Address"` TaggedAddresses map[string]string `json:"TaggedAddresses,omitempty"` }
Node single consul node
type Service ¶
type Service struct { ID string `json:"ID"` Service string `json:"Service"` Name string `json:"Name"` Tags []string `json:"Tags,omitempty"` Address string `json:"Address,omitempty"` Port int `json:"Port"` }
Service single consul service
type ServiceNode ¶
type ServiceNode struct { Node string `json:"Node"` Address string `json:"Address"` ServiceID string `json:"ServiceID"` ServiceName string `json:"ServiceName"` ServiceTags []string `json:"ServiceTags,omitempty"` ServiceAddress string `json:"ServiceAddress"` ServicePort int `json:"ServicePort"` }
ServiceNode single consul service-node
type ServiceNoder ¶
type ServiceNoder interface {
GetServiceNodes(addr, path string, serviceID string) (ServiceNodes, error)
}
ServiceNoder interface
type ServiceNodes ¶
type ServiceNodes []ServiceNode
ServiceNodes slice of service-nodes
func GetServiceNodes ¶
func GetServiceNodes(s ServiceNoder, addr, serviceID string) (ServiceNodes, error)
GetServiceNodes function to get slice of service-nodes
type ServiceRegister ¶
type ServiceRegister interface { Register(addr, path string, s *Service) error Unregister(addr, path, serviceID string) error }
ServiceRegister interface