package etcd
import "github.com/google/trillian/util/election2/etcd"
Package etcd provides an implementation of master election based on etcd.
Index ¶
- type Election
- func (e *Election) Await(ctx context.Context) error
- func (e *Election) Close(ctx context.Context) error
- func (e *Election) Resign(ctx context.Context) error
- func (e *Election) WithMastership(ctx context.Context) (context.Context, error)
- type Factory
Types ¶
type Election ¶
type Election struct {
// contains filtered or unexported fields
}
Election is an implementation of election2.Election based on etcd.
func (*Election) Await ¶
Await blocks until the instance captures mastership.
func (*Election) Close ¶
Close resigns and permanently stops participating in election. No other method should be called after Close.
func (*Election) Resign ¶
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 ¶
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 NewFactory ¶
NewFactory builds an election factory that uses the given parameters. The passed in etcd client should remain valid for the lifetime of the object.
func (*Factory) NewElection ¶
NewElection creates a specific Election instance.
Source Files ¶
- Version
- v1.7.1 (latest)
- Published
- Jan 9, 2025
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 5 days ago –
Tools for package owners.