consul

package
v0.16.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcquireLock

func AcquireLock(logger log.Logger, client *Client, leaderKey string) error

Types

type Client

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

Client is a helpful wrapper around consul operations needed by achgateway. This client is not goroutine safe, so concurrnet calls are not supported.

func NewConsulClient

func NewConsulClient(logger log.Logger, config *Config) (*Client, error)

func (*Client) AcquireLock added in v0.9.1

func (c *Client) AcquireLock(key string) error

func (*Client) ClearSession added in v0.9.3

func (c *Client) ClearSession() error

ClearSession will attempt to wipe the existing session and create a new one. Often this is done as an attempt to resolve consul or network errors.

func (*Client) SessionID added in v0.9.3

func (c *Client) SessionID() string

func (*Client) Shutdown added in v0.9.1

func (c *Client) Shutdown()

type Config

type Config struct {
	Address     string
	Scheme      string
	SessionPath string
	Tags        []string

	Token     string
	TokenFile string

	Datacenter string
	Namespace  string

	Session *SessionConfig

	TLS api.TLSConfig
}

type Session

type Session struct {
	ID   string
	Name string
}

type SessionConfig added in v0.9.0

type SessionConfig struct {
	CheckInterval time.Duration
}

Jump to

Keyboard shortcuts

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