fix proto files to conform with autogenpb
This commit is contained in:
parent
9160268326
commit
c3f0f41791
6
Makefile
6
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 experiments.pb.go vet
|
all: droplet.pb.go hypervisor.pb.go event.pb.go experiment.pb.go goimports vet
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
@GO111MODULE=off go vet
|
@GO111MODULE=off go vet
|
||||||
|
@ -31,8 +31,8 @@ hypervisor.pb.go: hypervisor.proto
|
||||||
event.pb.go: event.proto
|
event.pb.go: event.proto
|
||||||
autogenpb --proto event.proto
|
autogenpb --proto event.proto
|
||||||
|
|
||||||
experiments.pb.go: experiments.proto
|
experiment.pb.go: experiment.proto
|
||||||
autogenpb --proto experiments.proto
|
autogenpb --proto experiment.proto
|
||||||
|
|
||||||
deps:
|
deps:
|
||||||
apt install golang-goprotobuf-dev
|
apt install golang-goprotobuf-dev
|
||||||
|
|
|
@ -6,53 +6,53 @@ 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`
|
||||||
string uuid = 1; // I guess why not just have this on each file
|
string uuid = 1; // `autogenpb:uuid:d5d492e2-38d4-476b-86f3-f5abf01f9d6d`
|
||||||
string version = 2; // maybe can be used for protobuf schema change violations
|
string version = 2; // `autogenpb:version:v0.0.1`
|
||||||
repeated Droplet droplets = 3;
|
repeated Droplet droplets = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Droplet { // `autogenpb:marshal`
|
message Droplet { // `autogenpb:marshal`
|
||||||
string uuid = 1; // `autogenpb:unique` // should be unique across the cluster
|
string uuid = 1; // `autogenpb:unique` // should be unique across the cluster
|
||||||
string hostname = 2; // `autogenpb:unique` // should be unique and work in DNS
|
string hostname = 2; // `autogenpb:unique` // should be unique and work in DNS
|
||||||
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 start_state = 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 qemu_machine = 7; // the qemu machine type to use "pc-q35-9.0"
|
||||||
int64 spice_port = 8; // preferred port to use for spice
|
int64 spice_port = 8; // preferred port to use for spice
|
||||||
|
|
||||||
string preferred_hypervisor = 9; // the hypervisor to prefer to run the droplet on
|
string preferred_hypervisor = 9; // the hypervisor to prefer to run the droplet on
|
||||||
string force_hypervisor = 10; // use this hypervisor and this hypervisor only
|
string force_hypervisor = 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 preferred_arch = 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 local_only = 14; // this is only defined locally on the hypervisor
|
||||||
string custom_xml = 15; // if needed,
|
string custom_xml = 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 unstable_timeout = 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.
|
||||||
// These are passed around while the cluster to monitor and control the systems
|
// These are passed around while the cluster to monitor and control the systems
|
||||||
// but they are not saved to the config file
|
// but they are not saved to the config file
|
||||||
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 start_attempts = 3; // how many times a start has been attempted
|
||||||
string full_xml = 4; // the full libvirt xml to import
|
string full_xml = 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 last_poll = 5; // the last time we heard anything from this droplet
|
||||||
string image_url = 6; // url to the image
|
string image_url = 6; // url to the image
|
||||||
google.protobuf.Timestamp off_since = 7; // when the droplet was turned off
|
google.protobuf.Timestamp off_since = 7; // when the droplet was turned off
|
||||||
google.protobuf.Timestamp on_since = 8; // when the droplet was turned on
|
google.protobuf.Timestamp on_since = 8; // when the droplet was turned on
|
||||||
}
|
}
|
||||||
|
|
||||||
message Archive {
|
message Archive {
|
||||||
DropletArchive reason = 1; // why the droplet was archived
|
DropletArchive reason = 1; // why the droplet was archived
|
||||||
google.protobuf.Timestamp when = 2; // when it was archived
|
google.protobuf.Timestamp when = 2; // when it was archived
|
||||||
}
|
}
|
||||||
|
|
||||||
// virtual machine state
|
// virtual machine state
|
||||||
|
@ -71,13 +71,13 @@ enum DropletArchive {
|
||||||
}
|
}
|
||||||
|
|
||||||
message Network {
|
message Network {
|
||||||
string mac = 1;
|
string mac = 1;
|
||||||
string name = 2;
|
string name = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Disk {
|
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 qemu_arch = 4; // what arch. example: "x86_64" or "riscv64"
|
||||||
}
|
}
|
||||||
|
|
36
event.proto
36
event.proto
|
@ -6,11 +6,11 @@ import "google/protobuf/any.proto"; // Import the well-known type for Timestamp
|
||||||
|
|
||||||
// global settings for autogenpb `autogenpb:no-sort` `autogenpb:mutex`
|
// global settings for autogenpb `autogenpb:no-sort` `autogenpb:mutex`
|
||||||
|
|
||||||
message Events { // `autogenpb:marshal`
|
message Events { // `autogenpb:marshal`
|
||||||
string uuid = 1; // I guess why not just have this on each file
|
string uuid = 1; // `autogenpb:uuid:1e3a50c7-5916-4423-b33c-f0b977a7e446`
|
||||||
string version = 2; // maybe can be used for protobuf schema change violations
|
string version = 2; // `autogenpb:version:v0.0.1`
|
||||||
int64 event_size = 3; // max events to store in a single
|
int64 event_size = 3; // max events to store in a single
|
||||||
repeated Event events = 4; // all the events
|
repeated Event events = 4; // all the events
|
||||||
}
|
}
|
||||||
|
|
||||||
// this information leans towards being human readable not programatic
|
// this information leans towards being human readable not programatic
|
||||||
|
@ -19,19 +19,19 @@ message Events { // `autogenpb:marshal`
|
||||||
// homelab clouds normally don't have many events.
|
// homelab clouds normally don't have many events.
|
||||||
// we are talking less than 1 a minute. even 1 an hour is often a lot
|
// we are talking less than 1 a minute. even 1 an hour is often a lot
|
||||||
message Event {
|
message Event {
|
||||||
int32 id = 1; // `autogenpb:unique` // should be unique across the cluster
|
int32 id = 1; // `autogenpb:unique` // should be unique across the cluster
|
||||||
EventType etype = 2;
|
EventType etype = 2;
|
||||||
string droplet = 3; // name of the droplet
|
string droplet = 3; // name of the droplet
|
||||||
string droplet_uuid = 4; // uuid of the droplet
|
string droplet_uuid = 4; // uuid of the droplet
|
||||||
string hypervisor = 5; // name of the hypervisor
|
string hypervisor = 5; // name of the hypervisor
|
||||||
string hypervisor_uuid = 6; // uuid of the hypervisor
|
string hypervisor_uuid = 6; // uuid of the hypervisor
|
||||||
google.protobuf.Timestamp start = 7; // start time
|
google.protobuf.Timestamp start = 7; // start time
|
||||||
google.protobuf.Timestamp end = 8; // end time
|
google.protobuf.Timestamp end = 8; // end time
|
||||||
string field_name = 9; // the field name that changed
|
string field_name = 9; // the field name that changed
|
||||||
string orig_val = 10; // original value
|
string orig_val = 10; // original value
|
||||||
string new_val = 11; // new value
|
string new_val = 11; // new value
|
||||||
google.protobuf.Any orig_any = 12; // anypb format. probably overkill
|
google.protobuf.Any orig_any = 12; // anypb format. probably overkill
|
||||||
google.protobuf.Any new_any = 13; // anypb format
|
google.protobuf.Any new_any = 13; // anypb format
|
||||||
}
|
}
|
||||||
|
|
||||||
enum EventType {
|
enum EventType {
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
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
|
||||||
|
}
|
|
@ -1,21 +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.
|
|
||||||
}
|
|
|
@ -3,21 +3,21 @@ package virtbuf;
|
||||||
|
|
||||||
// global settings for autogenpb `autogenpb:mutex`
|
// global settings for autogenpb `autogenpb:mutex`
|
||||||
|
|
||||||
message Hypervisors { // `autogenpb:marshal`
|
message Hypervisors { // `autogenpb:marshal`
|
||||||
string uuid = 1; // I guess why not just have this on each file
|
string uuid = 1; // `autogenpb:uuid:6e3aa8b9-cf98-40f6-af58-3c6ad1edf4d4`
|
||||||
string version = 2; // maybe can be used for protobuf schema change violations
|
string version = 2; // `autogenpb:version:v0.0.1`
|
||||||
repeated Hypervisor hypervisors = 3;
|
repeated Hypervisor hypervisors = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Hypervisor {
|
message Hypervisor {
|
||||||
string uuid = 1; // `autogenpb:unique`
|
string uuid = 1; // `autogenpb:unique`
|
||||||
string hostname = 2; // `autogenpb:unique`
|
string hostname = 2; // `autogenpb:unique`
|
||||||
bool active = 3; // is allowed to start new droplets
|
bool active = 3; // is allowed to start new droplets
|
||||||
int64 cpus = 4;
|
int64 cpus = 4;
|
||||||
int64 memory = 5; // in bytes
|
int64 memory = 5; // in bytes
|
||||||
string comment = 6;
|
string comment = 6;
|
||||||
bool autoscan = 7; // to scan or not to scan by virtigo
|
bool autoscan = 7; // to scan or not to scan by virtigo
|
||||||
HypervisorArch arch = 8;
|
HypervisorArch arch = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
// think about this more
|
// think about this more
|
||||||
|
|
Loading…
Reference in New Issue