From adb44a864f37e99e775460cf74ec6701fc34ebf8 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 1 Nov 2024 00:58:12 -0500 Subject: [PATCH] more COBOL Signed-off-by: Jeff Carr --- Makefile | 10 +--------- cluster.proto | 23 ----------------------- human.go | 12 ++++++------ 3 files changed, 7 insertions(+), 38 deletions(-) delete mode 100644 cluster.proto diff --git a/Makefile b/Makefile index 1e7c471..3188393 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ # go install -all: droplet.pb.go hypervisor.pb.go cluster.pb.go event.pb.go experiments.pb.go +all: droplet.pb.go hypervisor.pb.go event.pb.go experiments.pb.go make -C example vet: lint @@ -54,14 +54,6 @@ experiments.pb.go: experiments.proto --go_opt=Mexperiments.proto=go.wit.com/lib/protobuf/virtbuf \ experiments.proto -cluster.pb.go: cluster.proto - cd ~/go/src && protoc --go_out=. --proto_path=go.wit.com/lib/protobuf/virtbuf \ - --go_opt=Mdroplet.proto=go.wit.com/lib/protobuf/virtbuf \ - --go_opt=Mcluster.proto=go.wit.com/lib/protobuf/virtbuf \ - --go_opt=Mhypervisor.proto=go.wit.com/lib/protobuf/virtbuf \ - --go_opt=Mevent.proto=go.wit.com/lib/protobuf/virtbuf \ - cluster.proto - deps: apt install golang-goprotobuf-dev apt install protobuf-compiler diff --git a/cluster.proto b/cluster.proto deleted file mode 100644 index 9569465..0000000 --- a/cluster.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; -package virtbuf; - -import "droplet.proto"; -import "hypervisor.proto"; -import "event.proto"; -import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp -import "google/protobuf/duration.proto"; // Import the well-known type for Timestamp - -message OldCluster { - int64 id = 1; - repeated string dirs = 2; - - repeated Droplet droplets = 3; - repeated Hypervisor hypervisors = 4; - // repeated Event events = 5; - - // Droplets d = 6; - Hypervisors h = 7; - Events e = 8; - google.protobuf.Timestamp unstable = 9; // the last time we heard anything from this droplet - google.protobuf.Duration unstable_timeout = 10; // the last time we heard anything from this droplet -} diff --git a/human.go b/human.go index c6a2fbc..02dc588 100644 --- a/human.go +++ b/human.go @@ -116,14 +116,14 @@ func (d *Droplet) SprintHeader() string { switch d.Current.State { case DropletState_ON: dur := time.Since(d.Current.OnSince.AsTime()) // time since 'ON' - header += " (on :" + FormatDuration(dur) + ")" + header += fmt.Sprintf(" (on :%3s)", FormatDuration(dur)) case DropletState_OFF: // everything is as it should be with this vm dur := time.Since(d.Current.OffSince.AsTime()) // time since 'OFF' - header += " (off:" + FormatDuration(dur) + ")" + header += fmt.Sprintf(" (off:%3s)", FormatDuration(dur)) default: dur := time.Since(d.Current.OffSince.AsTime()) // use 'OFF' here? - header += " (???:" + FormatDuration(dur) + ")" + header += fmt.Sprintf(" (?? :%3s)", FormatDuration(dur)) } return header } @@ -144,14 +144,14 @@ func (d *Droplet) SprintDumpHeader() string { switch d.Current.State { case DropletState_ON: dur := time.Since(d.Current.OnSince.AsTime()) // time since 'ON' - header += " (on :" + FormatDuration(dur) + ")" + header += fmt.Sprintf(" (on :%3s)", FormatDuration(dur)) case DropletState_OFF: // everything is as it should be with this vm dur := time.Since(d.Current.OffSince.AsTime()) // time since 'OFF' - header += " (off:" + FormatDuration(dur) + ")" + header += fmt.Sprintf(" (off:%3s)", FormatDuration(dur)) default: dur := time.Since(d.Current.OffSince.AsTime()) // use 'OFF' here? - header += " (???:" + FormatDuration(dur) + ")" + header += fmt.Sprintf(" (?? :%3s)", FormatDuration(dur)) } return header }