Documentation ¶
Index ¶
Constants ¶
const DefaultHeartbeatsPerTTL = 3
DefaultHeartbeatsPerTTL default number of heartbeats per TTL
const DefaultReregistrationDelay = time.Duration(5) * time.Second
DefaultReregistrationDelay default delay before registering
const DefaultTTL = time.Duration(60) * time.Second
DefaultTTL default TTL requested for registration
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HealthChecker ¶ added in v0.4.0
type HealthChecker struct {
// contains filtered or unexported fields
}
HealthChecker uses a collection of periodic health checks to manage registration. Registration is maintained while the state of the health checker is healthy. If the state changes to unhealthy, the registration agent is stopped. Similarly, if the state changes to healthy the registration agent is started again. The health checker is considered unhealthy if any health check's last reported status is unhealthy.
func NewHealthChecker ¶ added in v0.4.0
func NewHealthChecker(registration Lifecycle, checks []healthcheck.Agent) *HealthChecker
NewHealthChecker instantiates a health checker.
func (*HealthChecker) Start ¶ added in v0.4.0
func (checker *HealthChecker) Start()
Start healthchecking and maintaining registration with registry. Non-blocking.
func (*HealthChecker) Stop ¶ added in v0.4.0
func (checker *HealthChecker) Stop()
Stop healthchecking and maintaining registration with registry. Blocks until deregistration attempt is complete.
type Lifecycle ¶ added in v0.4.1
type Lifecycle interface { Start() Stop() }
Lifecycle is the interface implemented by objects that can be started and stopped.
type RegistrationAgent ¶
type RegistrationAgent struct {
// contains filtered or unexported fields
}
RegistrationAgent maintains a registration with registry.
func NewRegistrationAgent ¶
func NewRegistrationAgent(config RegistrationConfig) (*RegistrationAgent, error)
NewRegistrationAgent instantiates a new instance of the agent
func (*RegistrationAgent) Start ¶
func (agent *RegistrationAgent) Start()
Start maintaining registration with registry. Non-blocking.
func (*RegistrationAgent) Stop ¶
func (agent *RegistrationAgent) Stop()
Stop maintaining registration with registry. Blocks until deregistration attempt is complete.
type RegistrationConfig ¶
type RegistrationConfig struct { Registry api.ServiceRegistry Identity identity.Provider }
RegistrationConfig options