diff options
| author | Jeff Carr <[email protected]> | 2024-11-07 05:04:11 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-07 05:04:11 -0600 |
| commit | 907981a92da0537617a4c9fe39093f23004f461c (patch) | |
| tree | 5df2fcac84995b0027dceef658d652a3d74861d9 /add.go | |
| parent | b9766ce266286171f4688a32c679816bf824ae28 (diff) | |
rename Clusterv0.2.5
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'add.go')
| -rw-r--r-- | add.go | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -9,7 +9,7 @@ import ( "go.wit.com/log" ) -func (c *NewCluster) InitDroplet(hostname string) (*Droplet, error) { +func (c *Cluster) InitDroplet(hostname string) (*Droplet, error) { var d *Droplet d = new(Droplet) d.Current = new(Current) @@ -28,7 +28,7 @@ func (c *NewCluster) InitDroplet(hostname string) (*Droplet, error) { return d, nil } -func (c *NewCluster) appendDroplet(d *Droplet) { +func (c *Cluster) appendDroplet(d *Droplet) { c.Lock() defer c.Unlock() @@ -49,7 +49,7 @@ func (x *Hypervisor) SetMemoryGB(gb int) { x.Memory = int64(gb * 1024 * 1024 * 1024) } -func (c *NewCluster) FindDropletByName(name string) *Droplet { +func (c *Cluster) FindDropletByName(name string) *Droplet { loop := c.DropletsAll() // get the list of droplets for loop.Scan() { d := loop.Droplet() @@ -60,7 +60,7 @@ func (c *NewCluster) FindDropletByName(name string) *Droplet { return nil } -func (c *NewCluster) FindHypervisorByName(name string) *Hypervisor { +func (c *Cluster) FindHypervisorByName(name string) *Hypervisor { for _, h := range c.H.Hypervisors { if h.Hostname == name { return h @@ -69,7 +69,7 @@ func (c *NewCluster) FindHypervisorByName(name string) *Hypervisor { return nil } -func (c *NewCluster) AddHypervisor(hostname string, cpus int, mem int) *Hypervisor { +func (c *Cluster) AddHypervisor(hostname string, cpus int, mem int) *Hypervisor { h := c.FindHypervisorByName(hostname) if h != nil { return h @@ -90,15 +90,15 @@ func (c *NewCluster) AddHypervisor(hostname string, cpus int, mem int) *Hypervis return h } -func (c *NewCluster) AddEvent(e *Event) { +func (c *Cluster) AddEvent(e *Event) { c.e.Events = append(c.e.Events, e) } -func (c *NewCluster) AddDroplet(d *Droplet) { +func (c *Cluster) AddDroplet(d *Droplet) { c.d.Droplets = append(c.d.Droplets, d) } -func (c *NewCluster) AddDropletSimple(uuid string, hostname string, cpus int, mem int) *Droplet { +func (c *Cluster) AddDropletSimple(uuid string, hostname string, cpus int, mem int) *Droplet { d := c.FindDropletByName(hostname) if d != nil { return d @@ -120,7 +120,7 @@ func (c *NewCluster) AddDropletSimple(uuid string, hostname string, cpus int, me } // This isn't for the marketing department -func (c *NewCluster) AddDropletLocal(name string, hypername string) *Droplet { +func (c *Cluster) AddDropletLocal(name string, hypername string) *Droplet { d := &Droplet{ Hostname: name, } @@ -138,7 +138,7 @@ func (c *NewCluster) AddDropletLocal(name string, hypername string) *Droplet { return d } -func (c *NewCluster) BlankFields() { +func (c *Cluster) BlankFields() { loop := c.DropletsAll() // get the list of droplets for loop.Scan() { d := loop.Droplet() @@ -150,7 +150,7 @@ func (epb *Events) AppendEvent(e *Event) { epb.Events = append(epb.Events, e) } -func (c *NewCluster) ClusterStable() (bool, string) { +func (c *Cluster) ClusterStable() (bool, string) { last := time.Since(c.Unstable.AsTime()) if last > c.UnstableTimeout.AsDuration() { // the cluster has not been stable for 133 seconds @@ -162,7 +162,7 @@ func (c *NewCluster) ClusterStable() (bool, string) { } // check the cluster and droplet to make sure it's ready to start -func (c *NewCluster) DropletReady(d *Droplet) (bool, string) { +func (c *Cluster) DropletReady(d *Droplet) (bool, string) { if c == nil { return false, "cluster == nil" } |
