Documentation ¶
Index ¶
- Variables
- type ApiConsulClientI
- type ApiPairs
- type Client
- func (c *Client) AcquireSessionWithKey(key string) (bool, error)
- func (c *Client) Addresses(dc string, serviceName string, serviceTags []string) ([]string, error)
- func (c *Client) CheckLeadership(oldIsLeader bool, leaderKey string) (isLeader bool, noLeader bool)
- func (c *Client) CreateSession() (string, error)
- func (c *Client) Deregister(logger *logger.Logger, services ...RegistrableService)
- func (c *Client) DestroySession() error
- func (c *Client) IsMySessionIDInKey(key string) (bool, error)
- func (c *Client) KVGet(key string) ([]byte, error)
- func (c *Client) KVPut(key string, value []byte) error
- func (c *Client) Register(logger *logger.Logger, services ...RegistrableService) error
- func (c *Client) RenewSession() error
- func (c *Client) RenewSessionPeriodic(doneChan <-chan struct{}) error
- func (c *Client) TryBecomeLeader(leaderKey string) (bool, error)
- type Config
- type RegistrableService
- type Service
- type ServiceCheck
- type ServiceChecks
- type Services
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNilKV = errors.New("nil kv pair struct")
)
Functions ¶
This section is empty.
Types ¶
type ApiConsulClientI ¶
type ApiConsulClientI interface { Agent() *api.Agent Health() *api.Health KV() *api.KV Session() *api.Session }
ApiConsulClientI - for mocks
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client - custom consul client based on hashicorp client
func (*Client) AcquireSessionWithKey ¶
AcquireSessionWithKey - acquire session with key in Consul
func (*Client) CheckLeadership ¶
CheckLeadership - check leadership (also check not found any leader state)
func (*Client) CreateSession ¶
CreateSession - create session in Consul
func (*Client) Deregister ¶
func (c *Client) Deregister(logger *logger.Logger, services ...RegistrableService)
Deregister - deregister service in consul
func (*Client) DestroySession ¶
DestroySession - destroy session
func (*Client) IsMySessionIDInKey ¶
IsMySessionIDInKey - check is my session in Consul KV
func (*Client) Register ¶
func (c *Client) Register(logger *logger.Logger, services ...RegistrableService) error
Register - register service in Consul
func (*Client) RenewSessionPeriodic ¶
RenewSessionPeriodic - renew session periodic
type Config ¶
type Config struct { Address string Interval time.Duration Timeout time.Duration Tags []string DNS []string SessionTTL string `yaml:"sessionTTL"` WaitTimeout string `yaml:"waitTimeout"` // contains filtered or unexported fields }
Config - cfg for Consul
type RegistrableService ¶
RegistrableService - interface which need to impl for Consul register
type Service ¶
type Service = api.AgentServiceRegistration
type ServiceCheck ¶
type ServiceCheck = api.AgentServiceCheck
type ServiceChecks ¶
type ServiceChecks = api.AgentServiceChecks
Click to show internal directories.
Click to hide internal directories.