elect

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CmdAssert

func CmdAssert(ctx context.Context, client *clientv3.Client, office string, minRev int64, useJSON bool) (int, error)

func CmdWatch

func CmdWatch(ctx context.Context, client *clientv3.Client, office string, useJSON bool) (int, error)

func CmdWho

func CmdWho(ctx context.Context, client *clientv3.Client, office string, useJSON bool) (int, error)

func RunElect

func RunElect(ctx context.Context, logger *slog.Logger, endpoints []string, dialTimeout time.Duration, ttl time.Duration, killAfter time.Duration, restart bool, office string, waitLimit time.Duration, stableThreshold time.Duration, onAcquire string, onLose string, hookTimeout time.Duration, cmdArgs []string) (int, error)

Types

type AssertOutput

type AssertOutput struct {
	Held bool   `json:"held"`
	Rev  int64  `json:"rev"`
	Host string `json:"host"`
}

type ElectHolder

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

func NewElectHolder

func NewElectHolder(sess *core.CoreSession, office string, val string, waitLimit time.Duration) *ElectHolder

func (*ElectHolder) Acquire

func (eh *ElectHolder) Acquire(ctx context.Context) (int64, error)

func (*ElectHolder) Key

func (eh *ElectHolder) Key() string

func (*ElectHolder) Name

func (eh *ElectHolder) Name() string

func (*ElectHolder) Release

func (eh *ElectHolder) Release(ctx context.Context) error

Jump to

Keyboard shortcuts

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