mirror of
https://github.com/gluster/glusterd2.git
synced 2026-02-05 12:45:38 +01:00
broadcast an event on election of cleanup leader
Signed-off-by: Oshank Kumar <okumar@redhat.com>
This commit is contained in:
@@ -6,9 +6,11 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/gluster/glusterd2/glusterd2/events"
|
||||
"github.com/gluster/glusterd2/glusterd2/gdctx"
|
||||
"github.com/gluster/glusterd2/glusterd2/store"
|
||||
"github.com/gluster/glusterd2/glusterd2/transactionv2"
|
||||
"github.com/gluster/glusterd2/pkg/api"
|
||||
|
||||
"github.com/coreos/etcd/clientv3"
|
||||
"github.com/coreos/etcd/clientv3/concurrency"
|
||||
@@ -133,6 +135,7 @@ func (c *CleanupHandler) StartElecting() {
|
||||
log.Info("node got elected as cleanup leader")
|
||||
c.Lock()
|
||||
defer c.Unlock()
|
||||
events.Broadcast(newCleanupLeaderEvent())
|
||||
c.isLeader = true
|
||||
}
|
||||
|
||||
@@ -170,6 +173,15 @@ func StopCleanupLeader() {
|
||||
}
|
||||
}
|
||||
|
||||
func newCleanupLeaderEvent() *api.Event {
|
||||
data := map[string]string{
|
||||
"peer.id": gdctx.MyUUID.String(),
|
||||
"peer.name": gdctx.HostName,
|
||||
}
|
||||
|
||||
return events.New("cleanup leader elected", data, true)
|
||||
}
|
||||
|
||||
func init() {
|
||||
expVar := expvar.Get("txn")
|
||||
if expVar == nil {
|
||||
|
||||
Reference in New Issue
Block a user