package etcd

import "github.com/google/trillian/util/election2/etcd"

Package etcd provides an implementation of master election based on etcd.

Index

Constants

const ElectionName = "etcd"

ElectionName identifies the etcd election implementation.

Types

type Election

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

Election is an implementation of election2.Election based on etcd.

func (*Election) Await

func (e *Election) Await(ctx context.Context) error

Await blocks until the instance captures mastership.

func (*Election) Close

func (e *Election) Close(ctx context.Context) error

Close resigns and permanently stops participating in election. No other method should be called after Close.

func (*Election) Resign

func (e *Election) Resign(ctx context.Context) error

Resign releases mastership for this instance. The instance can be elected again using Await. Idempotent, might be useful to retry if fails.

func (*Election) WithMastership

func (e *Election) WithMastership(ctx context.Context) (context.Context, error)

WithMastership returns a "mastership context" which remains active until the instance stops being the master, or the passed in context is canceled.

type Factory

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

Factory creates Election instances.

func (*Factory) NewElection

func (f *Factory) NewElection(ctx context.Context, resourceID string) (election2.Election, error)

NewElection creates a specific Election instance.

Source Files

election.go provider.go

Version
v1.7.2 (latest)
Published
Apr 25, 2025
Platform
js/wasm
Imports
11 packages
Last checked
5 hours ago

Tools for package owners.