parent
706dbbc533
commit
adb44a864f
10
Makefile
10
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
|
||||
|
|
|
@ -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
|
||||
}
|
12
human.go
12
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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue