ballot

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ballot

type Ballot struct {
	Name          string        `mapstructure:"-"`
	ID            string        `mapstructure:"id"`
	Key           string        `mapstructure:"key"`
	ServiceChecks []string      `mapstructure:"serviceChecks"`
	Token         string        `mapstructure:"consul.token"`
	ExecOnPromote string        `mapstructure:"execOnPromote"`
	ExecOnDemote  string        `mapstructure:"execOnDemote"`
	PrimaryTag    string        `mapstructure:"primaryTag"`
	ConsulAddress string        `mapstructure:"consul.address"`
	TTL           time.Duration `mapstructure:"ttl"`
	LockDelay     time.Duration `mapstructure:"lockDelay"`
	// contains filtered or unexported fields
}

Ballot is a struct that holds the configuration for the leader election.

func New

func New(ctx context.Context, name string) (b *Ballot, err error)

New returns a new Ballot instance.

func (*Ballot) IsLeader

func (b *Ballot) IsLeader() bool

func (*Ballot) Run

func (b *Ballot) Run() (err error)

Run is the main loop for the leader election.

type CommandExecutor added in v0.0.3

type CommandExecutor interface {
	Command(name string, arg ...string) *exec.Cmd
}

type ConsulClient added in v0.0.3

type ConsulClient interface {
	Agent() *api.Agent
	Catalog() *api.Catalog
	KV() *api.KV
	Session() *api.Session
}

type ElectionPayload

type ElectionPayload struct {
	Address   string
	Port      int
	SessionID string
}

Jump to

Keyboard shortcuts

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