consul

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 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, consulSession *Session) error

Types

type Client

type Client struct {
	ConsulClient *consul.Client
	NodeId       string
	// contains filtered or unexported fields
}

func NewConsulClient

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

type Config

type Config struct {
	Address             string
	Scheme              string
	SessionPath         string
	Tags                []string
	HealthCheckInterval time.Duration
}

type Session

type Session struct {
	ID   string
	Name string
}

func NewSession

func NewSession(logger log.Logger, consulClient *Client, shardName string) (*Session, error)

type Wrapper

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

func NewWrapper

func NewWrapper(logger log.Logger, client *Client) *Wrapper

func (*Wrapper) Acquire

func (w *Wrapper) Acquire(shardKey string) (isLeader bool, err error)

func (*Wrapper) Shutdown

func (w *Wrapper) Shutdown()

Jump to

Keyboard shortcuts

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