Help us shape the future of Go! Take the 2026 Go Developer Survey

consul

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2016 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check interface {
	Run() *cstructs.CheckResult
	ID() string
	Interval() time.Duration
}

Check is an interface which check providers can implement for Nomad to run

type CheckRunner

type CheckRunner struct {
	// contains filtered or unexported fields
}

CheckRunner runs a given check in a specific interval and update a corresponding Consul TTL check

func NewCheckRunner

func NewCheckRunner(check Check, runCheck func(Check), logger *log.Logger) *CheckRunner

NewCheckRunner configures and returns a CheckRunner

func (*CheckRunner) Start

func (r *CheckRunner) Start()

Start is used to start the check. The check runs until stop is called

func (*CheckRunner) Stop

func (r *CheckRunner) Stop()

Stop is used to stop the check.

type ConsulConfig

type ConsulConfig struct {
	Addr      string
	Token     string
	Auth      string
	EnableSSL bool
	VerifySSL bool
	CAFile    string
	CertFile  string
	KeyFile   string
}

ConsulConfig is the configuration used to create a new ConsulService client

type ConsulService

type ConsulService struct {
	// contains filtered or unexported fields
}

ConsulService allows syncing of services and checks with Consul

func NewConsulService

func NewConsulService(config *ConsulConfig, logger *log.Logger, allocID string) (*ConsulService, error)

NewConsulService returns a new ConsulService

func (*ConsulService) KeepServices

func (c *ConsulService) KeepServices(services map[string]struct{}) error

KeepServices removes services from consul which are not present in the list of tasks passed to it

func (*ConsulService) PeriodicSync

func (c *ConsulService) PeriodicSync()

PeriodicSync triggers periodic syncing of services and checks with Consul. This is a long lived go-routine which is stopped during shutdown

func (*ConsulService) SetDelegatedChecks

func (c *ConsulService) SetDelegatedChecks(delegateChecks map[string]struct{}, createCheck func(*structs.ServiceCheck, string) (Check, error)) *ConsulService

SetDelegatedChecks sets the checks that nomad is going to run and report the result back to consul

func (*ConsulService) Shutdown

func (c *ConsulService) Shutdown() error

Shutdown de-registers the services and checks and shuts down periodic syncing

func (*ConsulService) SyncTask

func (c *ConsulService) SyncTask(task *structs.Task) error

SyncTask sync the services and task with consul

Jump to

Keyboard shortcuts

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