From 498bfe82f073d5641a42b057512396cc967524c1 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 22 Feb 2025 17:48:10 -0600 Subject: [PATCH] switch from virtbuf to virtpb --- create.go | 16 ++++++++-------- event.go | 6 +++--- structs.go | 8 ++++---- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/create.go b/create.go index 878a140..71bc2f8 100644 --- a/create.go +++ b/create.go @@ -8,7 +8,7 @@ import ( "path/filepath" "strings" - pb "go.wit.com/lib/protobuf/virtbuf" + "go.wit.com/lib/protobuf/virtpb" "go.wit.com/log" "google.golang.org/protobuf/proto" ) @@ -25,14 +25,14 @@ func createFilename(dir string, filename string) error { hostname := strings.TrimSuffix(filename, filetype) log.Info("hostname ==", hostname) - newDroplet := pb.NewDefaultDroplet(hostname) - newDisk := new(pb.Disk) + newDroplet := virtpb.NewDefaultDroplet(hostname) + newDisk := new(virtpb.Disk) newDisk.Filename = filename newDisk.Filepath = dir newDroplet.Disks = append(newDroplet.Disks, newDisk) - var eth *pb.Network - eth = new(pb.Network) + var eth *virtpb.Network + eth = new(virtpb.Network) eth.Name = "worldbr" newDroplet.Networks = append(newDroplet.Networks, eth) @@ -59,7 +59,7 @@ func createFilename(dir string, filename string) error { } // send protobuf as wire data -func postDropletWIRE(url string, d *pb.Droplet) (string, error) { +func postDropletWIRE(url string, d *virtpb.Droplet) (string, error) { var bytes []byte var err error // Automatically marshal to protobuf binary format @@ -74,11 +74,11 @@ func postDropletWIRE(url string, d *pb.Droplet) (string, error) { } // send protobuf in json format -func postDropletJSON(url string, d *pb.Droplet) (string, error) { +func postDropletJSON(url string, d *virtpb.Droplet) (string, error) { // send protobuf as JSON bytes, err := d.MarshalJSON() if err != nil { - log.Info("virtbuf.MarshalJson() failed:", err) + log.Info("virtpb.MarshalJson() failed:", err) return "", err } return post(url, bytes) diff --git a/event.go b/event.go index 9551aab..334d7c9 100644 --- a/event.go +++ b/event.go @@ -5,7 +5,7 @@ import ( "time" "go.wit.com/lib/gui/shell" - pb "go.wit.com/lib/protobuf/virtbuf" + "go.wit.com/lib/protobuf/virtpb" "go.wit.com/log" ) @@ -56,7 +56,7 @@ func dropletReady(d *pb.Droplet) (bool, string) { // this must be bool in string because accumulated output is sometimes // written to STDOUT, sometimes to http -func (h *HyperT) start(d *pb.Droplet) (bool, string) { +func (h *HyperT) start(d *virtpb.Droplet) (bool, string) { url := "http://" + h.pb.Hostname + ":2520/start?start=" + d.Hostname var msg string var data []byte @@ -75,7 +75,7 @@ func (h *HyperT) start(d *pb.Droplet) (bool, string) { return true, result } -func findDroplet(name string) *pb.Droplet { +func findDroplet(name string) *virtpb.Droplet { loop := me.cluster.DropletsAll() // get the list of droplets for loop.Scan() { d := loop.Next() diff --git a/structs.go b/structs.go index edd304b..7b68e77 100644 --- a/structs.go +++ b/structs.go @@ -3,7 +3,7 @@ package main import ( "time" - pb "go.wit.com/lib/protobuf/virtbuf" + "go.wit.com/lib/protobuf/virtpb" ) var me virtigoT @@ -20,8 +20,8 @@ func (b *virtigoT) Enable() { // this app's variables type virtigoT struct { - cluster *pb.Cluster // basic cluster settings - hmap map[*pb.Hypervisor]*HyperT // map to the local struct + cluster *virtpb.Cluster // basic cluster settings + hmap map[*virtpb.Hypervisor]*HyperT // map to the local struct names []string hypers []*HyperT killcount int @@ -35,7 +35,7 @@ type virtigoT struct { // the stuff that is needed for a hypervisor type HyperT struct { - pb *pb.Hypervisor // the Hypervisor protobuf + 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