diff --git a/CHANGELOG.md b/CHANGELOG.md index c82097ceed..c420e9da05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # TRILLIAN Changelog +### Election system +* Reintroduce an exported ectd `NewFactory` function. + ## HEAD ## v1.7.2 diff --git a/util/election2/etcd/election.go b/util/election2/etcd/election.go index 8691312be2..cadc0fdd42 100644 --- a/util/election2/etcd/election.go +++ b/util/election2/etcd/election.go @@ -132,6 +132,16 @@ type Factory struct { lockDir string } +// 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 NewFactory(instanceID string, client *clientv3.Client, lockDir string) *Factory { + return &Factory{ + client: client, + instanceID: instanceID, + lockDir: lockDir, + } +} + // NewElection creates a specific Election instance. func (f *Factory) NewElection(ctx context.Context, resourceID string) (election2.Election, error) { // TODO(pavelkalinnikov): Re-create the session if it expires.