diff --git a/Makefile b/Makefile index e1a98e7..fc490a4 100644 --- a/Makefile +++ b/Makefile @@ -1,28 +1,18 @@ -all: - # You must use the current protoc-gen-go - # protoc --version 3.6++ does not mean that protoc will generate version3 .go files - # - # apt remove golang-goprotobuf-dev - # apt install protobuf-compiler - # - # Then: - # go get -u github.com/golang/protobuf/protoc-gen-go - # cd ~/go/src/github.com/golang/protobuf/protoc-gen-go - # go install - # - # Then: - protoc --version - make droplet.pb.go - make hypervisor.pb.go - make cluster.pb.go +# You must use the current protoc-gen-go +# +# go-clone --go-src google.golang.org/protobuf +# cd ~/go/src/google.golang.org/protobuf/cmd/protoc-gen-go +# go install + + +all: droplet.pb.go hypervisor.pb.go cluster.pb.go events.pb.go make -C configfile -vet: +vet: lint GO111MODULE=off go vet - make lint lint: - buf lint droplet.proto + -buf lint droplet.proto # autofixes your import headers in your golang files goimports: @@ -52,6 +42,12 @@ hypervisor.pb.go: hypervisor.proto --go_opt=Mhypervisor.proto=go.wit.com/lib/protobuf/virtbuf \ hypervisor.proto +events.pb.go: events.proto + cd ~/go/src && protoc --go_out=. \ + --proto_path=go.wit.com/lib/protobuf/virtbuf \ + --go_opt=Mevents.proto=go.wit.com/lib/protobuf/virtbuf \ + events.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 \ @@ -59,19 +55,6 @@ cluster.pb.go: cluster.proto --go_opt=Mhypervisor.proto=go.wit.com/lib/protobuf/virtbuf \ cluster.proto - -events.pb.go: events.proto - protoc --go_out=. events.proto - -account.pb.go: account.proto - protoc --go_out=. account.proto - -config.pb.go: config.proto - protoc --go_out=. config.proto - -compile: - protoc --go_out=. *.proto - deps: apt install golang-goprotobuf-dev apt install protobuf-compiler diff --git a/events.proto b/events.proto new file mode 100644 index 0000000..995de5a --- /dev/null +++ b/events.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; +package virtbuf; + +message Events { + repeated Event stuff = 1; +} + +message Event { + int32 id = 1; + EventType etype = 2; + string droplet = 3; // uuid of the droplet + string hypervisor = 4; // uuid of the hypervisor +} + +enum EventType { + ADD = 0; + DELETE = 1; + POWERON = 2; + POWEROFF = 3; // should indicate a "normal" shutdown + HIBERNATE = 4; + MIGRATE = 5; + DEMO = 6; + GET = 7; // request something + LOGIN = 8; // attempt to login + OK = 9; // everything is ok + FAIL = 10; // everything failed + CRASH = 11; // droplet hard crashed +}