43 lines
1.2 KiB
Go
43 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"time"
|
|
|
|
pb "go.wit.com/lib/protobuf/virtbuf"
|
|
)
|
|
|
|
var me virtigoT
|
|
|
|
// disable the GUI
|
|
func (b *virtigoT) Disable() {
|
|
// b.mainbox.Disable()
|
|
}
|
|
|
|
// enable the GUI
|
|
func (b *virtigoT) Enable() {
|
|
// b.mainbox.Enable()
|
|
}
|
|
|
|
// this app's variables
|
|
type virtigoT struct {
|
|
cluster *pb.Cluster // basic cluster settings
|
|
delay time.Duration // how often to poll the hypervisors
|
|
hmap map[*pb.Hypervisor]*HyperT // map to the local struct
|
|
names []string
|
|
hypers []*HyperT
|
|
killcount int
|
|
unstable time.Time // the last time the cluster was incorrect
|
|
changed bool
|
|
unstableTimeout time.Duration // how long a droplet can be unstable until it's declared dead
|
|
clusterStableDuration time.Duration // how long the cluster must be stable before new droplets can be started
|
|
missingDropletTimeout time.Duration // how long a droplet can be missing for
|
|
}
|
|
|
|
// the stuff that is needed for a hypervisor
|
|
type HyperT struct {
|
|
pb *pb.Hypervisor // the Hypervisor protobuf
|
|
dog *time.Ticker // the watchdog timer itself
|
|
lastpoll time.Time // the last time the hypervisor polled
|
|
killcount int
|
|
}
|