cleanups for gui pb tables
This commit is contained in:
parent
ddc0410126
commit
2381c65887
5
Makefile
5
Makefile
|
@ -3,7 +3,7 @@
|
||||||
# cd ~/go/src/google.golang.org/protobuf/cmd/protoc-gen-go
|
# cd ~/go/src/google.golang.org/protobuf/cmd/protoc-gen-go
|
||||||
# go install
|
# go install
|
||||||
|
|
||||||
all: droplet.pb.go hypervisor.pb.go event.pb.go experiment.pb.go goimports vet
|
all: droplet.pb.go hypervisor.pb.go event.pb.go goimports vet
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
@GO111MODULE=off go vet
|
@GO111MODULE=off go vet
|
||||||
|
@ -31,9 +31,6 @@ hypervisor.pb.go: hypervisor.proto
|
||||||
event.pb.go: event.proto
|
event.pb.go: event.proto
|
||||||
autogenpb --proto event.proto
|
autogenpb --proto event.proto
|
||||||
|
|
||||||
experiment.pb.go: experiment.proto
|
|
||||||
autogenpb --proto experiment.proto
|
|
||||||
|
|
||||||
deps:
|
deps:
|
||||||
apt install golang-goprotobuf-dev
|
apt install golang-goprotobuf-dev
|
||||||
apt install protobuf-compiler
|
apt install protobuf-compiler
|
||||||
|
|
|
@ -18,6 +18,10 @@ type Cluster struct {
|
||||||
UnstableTimeout *durationpb.Duration
|
UnstableTimeout *durationpb.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Cluster) GetDropletsPB() *Droplets {
|
||||||
|
return c.d
|
||||||
|
}
|
||||||
|
|
||||||
// adds a new droplet. enforce unique hostnames
|
// adds a new droplet. enforce unique hostnames
|
||||||
func (c *Cluster) AddDroplet(newd *Droplet) bool {
|
func (c *Cluster) AddDroplet(newd *Droplet) bool {
|
||||||
c.Lock()
|
c.Lock()
|
||||||
|
|
|
@ -6,7 +6,7 @@ import "google/protobuf/timestamp.proto"; // Import the well-known type for Time
|
||||||
|
|
||||||
// global settings for autogenpb `autogenpb:mutex`
|
// global settings for autogenpb `autogenpb:mutex`
|
||||||
|
|
||||||
message Droplets { // `autogenpb:marshal`
|
message Droplets { // `autogenpb:marshal` `autogenpb:gui`
|
||||||
string uuid = 1; // `autogenpb:uuid:d5d492e2-38d4-476b-86f3-f5abf01f9d6d`
|
string uuid = 1; // `autogenpb:uuid:d5d492e2-38d4-476b-86f3-f5abf01f9d6d`
|
||||||
string version = 2; // `autogenpb:version:v0.0.1`
|
string version = 2; // `autogenpb:version:v0.0.1`
|
||||||
repeated Droplet droplets = 3;
|
repeated Droplet droplets = 3;
|
||||||
|
@ -18,22 +18,22 @@ message Droplet { // `autogenpb
|
||||||
int64 cpus = 3; // what's the point of int64 vs int32
|
int64 cpus = 3; // what's the point of int64 vs int32
|
||||||
int64 memory = 4; // in bytes
|
int64 memory = 4; // in bytes
|
||||||
Current current = 5; // what the state and values of the droplet is
|
Current current = 5; // what the state and values of the droplet is
|
||||||
DropletState start_state = 6; // what the state of the droplet is SUPPOSED TO BE ('on' or 'off')
|
DropletState startState = 6; // what the state of the droplet is SUPPOSED TO BE ('on' or 'off')
|
||||||
string qemu_machine = 7; // the qemu machine type to use "pc-q35-9.0"
|
string qemuMachine = 7; // the qemu machine type to use "pc-q35-9.0"
|
||||||
int64 spice_port = 8; // preferred port to use for spice
|
int64 spicePort = 8; // preferred port to use for spice
|
||||||
|
|
||||||
string preferred_hypervisor = 9; // the hypervisor to prefer to run the droplet on
|
string preferredHypervisor = 9; // the hypervisor to prefer to run the droplet on
|
||||||
string force_hypervisor = 10; // use this hypervisor and this hypervisor only
|
string forceHypervisor = 10; // use this hypervisor and this hypervisor only
|
||||||
string preferred_arch = 11; // the cpu arch to use "x86_64" (should really get this from the disk?)
|
string preferredArch = 11; // the cpu arch to use "x86_64" (should really get this from the disk?)
|
||||||
repeated Network networks = 12; // really just mac addresses. should be unique across cluster
|
repeated Network networks = 12; // really just mac addresses. should be unique across cluster
|
||||||
repeated Disk disks = 13; // disks to attach
|
repeated Disk disks = 13; // disks to attach
|
||||||
|
|
||||||
string local_only = 14; // this is only defined locally on the hypervisor
|
string localOnly = 14; // this is only defined locally on the hypervisor
|
||||||
string custom_xml = 15; // if needed,
|
string customXml = 15; // if needed,
|
||||||
Archive archive = 16; // what the state of the droplet is SUPPOSED TO BE ('on' or 'off')
|
Archive archive = 16; // what the state of the droplet is SUPPOSED TO BE ('on' or 'off')
|
||||||
|
|
||||||
google.protobuf.Timestamp unstable = 39; // the last time we heard anything from this droplet
|
google.protobuf.Timestamp unstable = 39; // the last time we heard anything from this droplet
|
||||||
google.protobuf.Duration unstable_timeout = 40; // the last time we heard anything from this droplet
|
google.protobuf.Duration unstableTimeout = 40; // the last time we heard anything from this droplet
|
||||||
}
|
}
|
||||||
|
|
||||||
// volatile data. the current settings and values of things.
|
// volatile data. the current settings and values of things.
|
||||||
|
@ -42,12 +42,12 @@ message Droplet { // `autogenpb
|
||||||
message Current {
|
message Current {
|
||||||
DropletState state = 1; // used to track the current state before taking any action
|
DropletState state = 1; // used to track the current state before taking any action
|
||||||
string hypervisor = 2; // the current hypervisor the droplet is running on
|
string hypervisor = 2; // the current hypervisor the droplet is running on
|
||||||
int64 start_attempts = 3; // how many times a start has been attempted
|
int64 startAttempts = 3; // how many times a start has been attempted
|
||||||
string full_xml = 4; // the full libvirt xml to import
|
string fullXml = 4; // the full libvirt xml to import
|
||||||
google.protobuf.Timestamp last_poll = 5; // the last time we heard anything from this droplet
|
google.protobuf.Timestamp lastPoll = 5; // the last time we heard anything from this droplet
|
||||||
string image_url = 6; // url to the image
|
string imageUrl = 6; // url to the image
|
||||||
google.protobuf.Timestamp off_since = 7; // when the droplet was turned off
|
google.protobuf.Timestamp offSince = 7; // when the droplet was turned off
|
||||||
google.protobuf.Timestamp on_since = 8; // when the droplet was turned on
|
google.protobuf.Timestamp onSince = 8; // when the droplet was turned on
|
||||||
}
|
}
|
||||||
|
|
||||||
message Archive {
|
message Archive {
|
||||||
|
@ -79,5 +79,5 @@ message Disk {
|
||||||
string filename = 1;
|
string filename = 1;
|
||||||
string filepath = 2;
|
string filepath = 2;
|
||||||
int64 size = 3;
|
int64 size = 3;
|
||||||
string qemu_arch = 4; // what arch. example: "x86_64" or "riscv64"
|
string qemuArch = 4; // what arch. example: "x86_64" or "riscv64"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
syntax = "proto3";
|
|
||||||
package virtbuf;
|
|
||||||
|
|
||||||
import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp
|
|
||||||
import "google/protobuf/any.proto"; // Import the well-known type for Timestamp
|
|
||||||
|
|
||||||
// global settings for autogenpb `autogenpb:no-sort` `autogenpb:no-marshal`
|
|
||||||
|
|
||||||
message WhatsThis {
|
|
||||||
// is it possible to have custom formatting in JSON and TEXT marshal/unmarshal ?
|
|
||||||
WhatInfo humantest = 1;
|
|
||||||
|
|
||||||
google.protobuf.Timestamp end = 2; // end time
|
|
||||||
google.protobuf.Any orig_val = 3; // original value
|
|
||||||
google.protobuf.Any new_val = 4; // new value
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is for exerimenting
|
|
||||||
message WhatInfo {
|
|
||||||
int64 capacity = 1; // Stores the storage capacity in bytes.
|
|
||||||
}
|
|
||||||
|
|
||||||
message Experiment {
|
|
||||||
}
|
|
||||||
|
|
||||||
message Experiments { // `autogenpb:marshal` `autogenpb:mutex`
|
|
||||||
string uuid = 1; // `autogenpb:uuid:aadb95db-d798-4647-8c59-cce82e8f1ed6`
|
|
||||||
string version = 2; // `autogenpb:version:v0.0.1`
|
|
||||||
repeated Experiment Experiments = 3; // THIS MUST BE Experiment and then Experiments
|
|
||||||
}
|
|
|
@ -3,7 +3,7 @@ package virtbuf;
|
||||||
|
|
||||||
// global settings for autogenpb `autogenpb:mutex`
|
// global settings for autogenpb `autogenpb:mutex`
|
||||||
|
|
||||||
message Hypervisors { // `autogenpb:marshal`
|
message Hypervisors { // `autogenpb:marshal` `autogenpb:gui`
|
||||||
string uuid = 1; // `autogenpb:uuid:6e3aa8b9-cf98-40f6-af58-3c6ad1edf4d4`
|
string uuid = 1; // `autogenpb:uuid:6e3aa8b9-cf98-40f6-af58-3c6ad1edf4d4`
|
||||||
string version = 2; // `autogenpb:version:v0.0.1`
|
string version = 2; // `autogenpb:version:v0.0.1`
|
||||||
repeated Hypervisor hypervisors = 3;
|
repeated Hypervisor hypervisors = 3;
|
||||||
|
|
|
@ -39,22 +39,6 @@ func CreateSampleHypervisor(hostname string, mem int) *Hypervisor {
|
||||||
return h
|
return h
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateExperiment(total int) *WhatsThis {
|
|
||||||
var e *WhatsThis
|
|
||||||
e = new(WhatsThis)
|
|
||||||
|
|
||||||
// info := StorageInfo{Capacity: 64}
|
|
||||||
// e.Humantest = &info
|
|
||||||
if e.Humantest == nil {
|
|
||||||
var newInfo WhatInfo
|
|
||||||
newInfo = WhatInfo{Capacity: 64}
|
|
||||||
e.Humantest = &newInfo
|
|
||||||
} else {
|
|
||||||
e.Humantest.Capacity = SetGB(total * 32)
|
|
||||||
}
|
|
||||||
return e
|
|
||||||
}
|
|
||||||
|
|
||||||
func CreateSampleEvents(total int) *Events {
|
func CreateSampleEvents(total int) *Events {
|
||||||
var e *Events
|
var e *Events
|
||||||
e = new(Events)
|
e = new(Events)
|
||||||
|
|
Loading…
Reference in New Issue