Documentation ¶
Index ¶
- Variables
- func ReadTxt(c *ConsulOperator, file string) ([]byte, error)
- type ConsulApp
- type ConsulAppInfo
- type ConsulOperator
- func (c *ConsulOperator) Acquire(key string, stopChan <-chan struct{}) error
- func (c *ConsulOperator) Delete(name string) error
- func (c *ConsulOperator) DeregisterService() error
- func (c *ConsulOperator) Fix()
- func (c *ConsulOperator) Get(name string) ([]byte, error)
- func (c *ConsulOperator) GetEx(name string) ([]byte, uint64, error)
- func (c *ConsulOperator) ListService(name string) ([]*consulapi.CatalogService, error)
- func (c *ConsulOperator) ListServices() (map[string][]string, error)
- func (c *ConsulOperator) Ping() error
- func (c *ConsulOperator) PrintServices(name string) error
- func (c *ConsulOperator) Put(name string, value []byte) error
- func (c *ConsulOperator) RegisterService() error
- func (c *ConsulOperator) Release(key string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotExist = errors.New("NOT EXIST") HealthPath = "health" )
Functions ¶
Types ¶
type ConsulApp ¶
type ConsulApp struct {
*ConsulOperator
}
func NewConsulApp ¶
create a consul app arg heathHost is must parameter, a health http address of app arg agent is option, if empty using default 127.0.0.1:8500
func NewConsulAppWithCfg ¶
create a consul app with load cfg, using 127.0.0.1:8500 cfg is required parameter, the cfg address arg heathHost is must parameter, a health http address of app arg consulUrl is an FQDN format string which contains consul host,port,configpath, if configpath is empty, ${appname}.yml, config/${appname} will be tried to load in order
type ConsulAppInfo ¶
type ConsulAppInfo struct { ConsulHost string `json:"consul_host" yaml:"consul_host"` ConsulPort int `json:"consul_port" yaml:"consul_port"` Config string `json:"config" yaml:"config"` Values url.Values `json:"values" yaml:"values"` ServicePort int `json:"service_port" yaml:"service_port"` ServiceIP string `json:"service_ip" yaml:"service_ip"` ServiceName string `json:"service_name" yaml:"service_name"` CheckInterval string `json:"check_interval" yaml:"check_interval"` CheckHTTP string `json:"check_http" yaml:"check_http"` CheckTCP string `json:"check_tcp" yaml:"check_tcp"` }
func ParseConsulUrl ¶
func ParseConsulUrl(consulUrl string) (*ConsulAppInfo, error)
type ConsulOperator ¶
type ConsulOperator struct { *ConsulAppInfo // contains filtered or unexported fields }
func NewConsulOp ¶
func NewConsulOp(consulUrl string) (*ConsulOperator, error)
func (*ConsulOperator) Acquire ¶
func (c *ConsulOperator) Acquire(key string, stopChan <-chan struct{}) error
func (*ConsulOperator) Delete ¶
func (c *ConsulOperator) Delete(name string) error
func (*ConsulOperator) DeregisterService ¶
func (c *ConsulOperator) DeregisterService() error
func (*ConsulOperator) Fix ¶
func (c *ConsulOperator) Fix()
func (*ConsulOperator) ListService ¶
func (c *ConsulOperator) ListService(name string) ([]*consulapi.CatalogService, error)
func (*ConsulOperator) ListServices ¶
func (c *ConsulOperator) ListServices() (map[string][]string, error)
func (*ConsulOperator) Ping ¶
func (c *ConsulOperator) Ping() error
func (*ConsulOperator) PrintServices ¶
func (c *ConsulOperator) PrintServices(name string) error
func (*ConsulOperator) RegisterService ¶
func (c *ConsulOperator) RegisterService() error
func (*ConsulOperator) Release ¶
func (c *ConsulOperator) Release(key string) error
Click to show internal directories.
Click to hide internal directories.