github.com/zoomfoo/nomad@v0.8.5-0.20180907175415-f28fd3a1a056/nomad/merge.go (about)

     1  package nomad
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/hashicorp/serf/serf"
     7  )
     8  
     9  // serfMergeDelegate is used to handle a cluster merge on the gossip
    10  // ring. We check that the peers are nomad servers and abort the merge
    11  // otherwise.
    12  type serfMergeDelegate struct {
    13  }
    14  
    15  func (md *serfMergeDelegate) NotifyMerge(members []*serf.Member) error {
    16  	for _, m := range members {
    17  		ok, _ := isNomadServer(*m)
    18  		if !ok {
    19  			return fmt.Errorf("member '%s' is not a server", m.Name)
    20  		}
    21  	}
    22  	return nil
    23  }