stub out some kinda events something or other

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-22 23:35:52 -05:00
parent 2fe96457ef
commit 662e3a5849
2 changed files with 44 additions and 33 deletions

View File

@ -1,28 +1,18 @@
all: # You must use the current protoc-gen-go
# You must use the current protoc-gen-go #
# protoc --version 3.6++ does not mean that protoc will generate version3 .go files # go-clone --go-src google.golang.org/protobuf
# # cd ~/go/src/google.golang.org/protobuf/cmd/protoc-gen-go
# apt remove golang-goprotobuf-dev # go install
# apt install protobuf-compiler
#
# Then: all: droplet.pb.go hypervisor.pb.go cluster.pb.go events.pb.go
# 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
make -C configfile make -C configfile
vet: vet: lint
GO111MODULE=off go vet GO111MODULE=off go vet
make lint
lint: lint:
buf lint droplet.proto -buf lint droplet.proto
# autofixes your import headers in your golang files # autofixes your import headers in your golang files
goimports: goimports:
@ -52,6 +42,12 @@ hypervisor.pb.go: hypervisor.proto
--go_opt=Mhypervisor.proto=go.wit.com/lib/protobuf/virtbuf \ --go_opt=Mhypervisor.proto=go.wit.com/lib/protobuf/virtbuf \
hypervisor.proto 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 cluster.pb.go: cluster.proto
cd ~/go/src && protoc --go_out=. --proto_path=go.wit.com/lib/protobuf/virtbuf \ 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=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 \ --go_opt=Mhypervisor.proto=go.wit.com/lib/protobuf/virtbuf \
cluster.proto 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: deps:
apt install golang-goprotobuf-dev apt install golang-goprotobuf-dev
apt install protobuf-compiler apt install protobuf-compiler

28
events.proto Normal file
View File

@ -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
}