2024-10-12 10:59:11 -05:00
|
|
|
package main
|
|
|
|
|
2024-10-22 17:27:24 -05:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
pb "go.wit.com/lib/protobuf/virtbuf"
|
|
|
|
)
|
2024-10-12 10:59:11 -05:00
|
|
|
|
|
|
|
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 {
|
2024-10-22 17:27:24 -05:00
|
|
|
cluster *pb.Cluster
|
2024-10-13 03:20:48 -05:00
|
|
|
names []string
|
|
|
|
hypers []*HyperT
|
|
|
|
droplets []*DropletT
|
2024-10-23 00:48:35 -05:00
|
|
|
delay time.Duration // how often to poll the hypervisors
|
2024-10-13 03:20:48 -05:00
|
|
|
killcount int
|
2024-10-13 04:34:55 -05:00
|
|
|
unstable time.Time // the last time the cluster was incorrect
|
2024-10-12 10:59:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// the stuff that is needed for a hypervisor
|
|
|
|
type HyperT struct {
|
2024-10-22 17:27:24 -05:00
|
|
|
pb *pb.Hypervisor // the Hypervisor protobuf
|
2024-10-22 19:57:49 -05:00
|
|
|
dog *time.Ticker // the watchdog timer itself
|
2024-10-22 17:27:24 -05:00
|
|
|
lastpoll time.Time // the last time the hypervisor polled
|
2024-10-13 00:57:29 -05:00
|
|
|
killcount int
|
2024-10-12 10:59:11 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// the stuff that is needed for a hypervisor
|
|
|
|
type DropletT struct {
|
2024-10-22 19:34:50 -05:00
|
|
|
pb *pb.Droplet // the Droplet protobuf
|
|
|
|
CurrentState string // what the state of the droplet is ACTUALLY IS
|
|
|
|
h *HyperT // the hypervisor it's currently running on
|
|
|
|
lastpoll time.Time // the last time the droplet was seen running
|
|
|
|
starts int // how many times a start event has been attempted
|
2024-10-12 10:59:11 -05:00
|
|
|
}
|