diff --git a/masterelection/masterelection.go b/masterelection/masterelection.go index b8da182512ef115fb37a38186bf16dec4ba85511..3b707e0d2bca05b8cb2a22af6e1d9f7e55e4bb75 100644 --- a/masterelection/masterelection.go +++ b/masterelection/masterelection.go @@ -51,11 +51,10 @@ type MasterElection struct { state State } -// NewMasterElection creates a new MasterElection object that will -// establish a lock on 'path'. It will send state transitions to -// 'sch', if provided. If 'sch' is not nil, it will be closed when -// Run() terminates. -func NewMasterElection(client autoradio.EtcdClient, path, data string, ttl uint64, sch chan State) *MasterElection { +// New creates a new MasterElection object that will establish a lock +// on 'path'. It will send state transitions to 'sch', if provided. If +// 'sch' is not nil, it will be closed when Run() terminates. +func New(client autoradio.EtcdClient, path, data string, ttl uint64, sch chan State) *MasterElection { if ttl < 1 { ttl = 1 } diff --git a/masterelection/masterelection_test.go b/masterelection/masterelection_test.go index 21c5b4f7ef91ad64b225dcd3e3f3b403c3587dfe..e342f7e491441abd81df625fc2ce3808a0da3bd3 100644 --- a/masterelection/masterelection_test.go +++ b/masterelection/masterelection_test.go @@ -47,7 +47,7 @@ func TestMasterElection(t *testing.T) { var stop []chan bool for i := 0; i < n; i++ { stopCh := make(chan bool) - m := NewMasterElection( + m := New( etcd, lockPath, fmt.Sprintf("%d", i), diff --git a/node/node.go b/node/node.go index dc5622859597ace3330bc93f8a32170d39955a1c..72295be705a18ea38090ebb50494f1186eade3fb 100644 --- a/node/node.go +++ b/node/node.go @@ -313,7 +313,7 @@ func NewRadioNode(name string, ips []net.IP, netDev string, bwLimit float64, max name: name, ips: ips, client: client, - me: masterelection.NewMasterElection( + me: masterelection.New( client, autoradio.MasterElectionPath, string(minfodata), @@ -565,7 +565,7 @@ func (t *transcoder) run() { // within the scope of this function. update := make(chan masterelection.State) mestop := make(chan bool) - me := masterelection.NewMasterElection( + me := masterelection.New( t.client, autoradio.TranscoderMasterElectionBase+t.params.TargetMount, t.nodeName,