2015-06-03 10:58:00 +00:00
|
|
|
package nomad
|
|
|
|
|
2015-06-04 11:15:46 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/hashicorp/serf/serf"
|
|
|
|
)
|
2015-06-03 10:58:00 +00:00
|
|
|
|
|
|
|
// serfMergeDelegate is used to handle a cluster merge on the gossip
|
|
|
|
// ring. We check that the peers are nomad servers and abort the merge
|
|
|
|
// otherwise.
|
|
|
|
type serfMergeDelegate struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (md *serfMergeDelegate) NotifyMerge(members []*serf.Member) error {
|
2015-06-04 11:15:46 +00:00
|
|
|
for _, m := range members {
|
|
|
|
ok, _ := isNomadServer(*m)
|
|
|
|
if !ok {
|
|
|
|
return fmt.Errorf("member '%s' is not a server", m.Name)
|
|
|
|
}
|
|
|
|
}
|
2015-06-03 10:58:00 +00:00
|
|
|
return nil
|
|
|
|
}
|