summaryrefslogtreecommitdiff
path: root/structs.go
blob: c54e6c265369cdd4af92ab356384ef13d2ca8136 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package main

import (
	"net/url"
	"time"

	"go.wit.com/dev/alexflint/arg"
	"go.wit.com/gui"
	"go.wit.com/lib/gadgets"
	"go.wit.com/lib/protobuf/virtpb"
)

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 {
	pp                    *arg.Parser                    // go-arg parser
	cluster               *virtpb.OldCluster             // basic cluster settings
	myGui                 *gui.Node                      // the gui toolkit handle
	e                     *virtpb.Events                 // virt protobuf events
	hmap                  map[*virtpb.Hypervisor]*HyperT // map to the local struct
	names                 []string                       // ?
	hypers                []*HyperT                      // notsure
	killcount             int                            // how many times virtigo-d has had to been killed
	unstable              time.Time                      // the last time the cluster was incorrect
	changed               bool                           // have things changed?
	hyperPollDelay        time.Duration                  // how often to poll the hypervisors
	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
	status                *gui.Node                      // the cluster status
	lastuptime            *gui.Node                      // the last time uptime was checked by Kuma
	admin                 *adminT                        // the admin struct
	clusters              *virtpb.Clusters               // clusters protobuf
	cmap                  map[*virtpb.Cluster]*adminT    // map to local GUI objects and the protobuf
	gwin                  *gadgets.GenericWindow         // main window
}

type adminT struct {
	// admin mode
	cluster     *virtpb.Cluster     // the cluster protobuf
	droplets    *virtpb.Droplets    // your droplets
	hypervisors *virtpb.Hypervisors // yep
	// events      *virtpb.Events         // yep
	uptime *gui.Node              // the uptime message
	dwin   *stdDropletTableWin    // the droplet window
	hwin   *stdHypervisorTableWin // the hypervisor window
	ewin   *stdEventTableWin      // the events window
	url    *url.URL               // URL for the cloud
}

// the stuff that is needed for a hypervisor
type HyperT struct {
	pb           *virtpb.Hypervisor   // the Hypervisor protobuf
	dog          *time.Ticker         // the watchdog timer itself
	lastpoll     time.Time            // the last time the hypervisor polled
	lastDroplets map[string]time.Time // the vm's in the last poll
	killcount    int                  // how many times the daemon has been forcably killed
}