From e43f09fc34f33f5012747ed3f1363d4feca98161 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 7 Feb 2025 09:57:40 -0600 Subject: [PATCH] Notes added by 'git notes append' --- 21070d370331239fb90f6c70295d6595591f73d2 | 451 +++++++++++++++++++++++ 1 file changed, 451 insertions(+) diff --git a/21070d370331239fb90f6c70295d6595591f73d2 b/21070d370331239fb90f6c70295d6595591f73d2 index 637f027..6b01e3f 100644 --- a/21070d370331239fb90f6c70295d6595591f73d2 +++ b/21070d370331239fb90f6c70295d6595591f73d2 @@ -1484,3 +1484,454 @@ func (v *Events) Unmarshal(data []byte) error { } // `autogen:event.pb.go` + +// Code modified by go.wit.com/apps/autogenpb DO NOT EDIT. +// +// user defined Mutex locks were auto added +// +// autogenpb version & build time: v0.0.50 2025-02-07_10:22:09_UTC +// autogenpb auto generates Sort(), Unique() and Marshal() functions +// go install go.wit.com/apps/autogenpb@latest + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.35.2-devel +// protoc v3.21.12 +// source: event.proto + +package virtbuf // autogenpb changed the package name + +import ( + reflect "reflect" + sync "sync" + + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type EventType int32 + +const ( + EventType_ADD EventType = 0 + EventType_DELETE EventType = 1 + EventType_POWERON EventType = 2 + EventType_POWEROFF EventType = 3 // should indicate a "normal" shutdown + EventType_HIBERNATE EventType = 4 + EventType_MIGRATE EventType = 5 + EventType_DEMO EventType = 6 + EventType_GET EventType = 7 // request something + EventType_LOGIN EventType = 8 // attempt to login + EventType_OK EventType = 9 // everything is ok + EventType_FAIL EventType = 10 // everything failed + EventType_CRASH EventType = 11 // droplet hard crashed + EventType_CHANGE EventType = 12 // droplet or hypervisor config change +) + +// Enum value maps for EventType. +var ( + EventType_name = map[int32]string{ + 0: "ADD", + 1: "DELETE", + 2: "POWERON", + 3: "POWEROFF", + 4: "HIBERNATE", + 5: "MIGRATE", + 6: "DEMO", + 7: "GET", + 8: "LOGIN", + 9: "OK", + 10: "FAIL", + 11: "CRASH", + 12: "CHANGE", + } + EventType_value = map[string]int32{ + "ADD": 0, + "DELETE": 1, + "POWERON": 2, + "POWEROFF": 3, + "HIBERNATE": 4, + "MIGRATE": 5, + "DEMO": 6, + "GET": 7, + "LOGIN": 8, + "OK": 9, + "FAIL": 10, + "CRASH": 11, + "CHANGE": 12, + } +) + +func (x EventType) Enum() *EventType { + p := new(EventType) + *p = x + return p +} + +func (x EventType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (EventType) Descriptor() protoreflect.EnumDescriptor { + return file_event_proto_enumTypes[0].Descriptor() +} + +func (EventType) Type() protoreflect.EnumType { + return &file_event_proto_enumTypes[0] +} + +func (x EventType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use EventType.Descriptor instead. +func (EventType) EnumDescriptor() ([]byte, []int) { + return file_event_proto_rawDescGZIP(), []int{0} +} + +type Events struct { + sync.RWMutex // auto-added by go.wit.com/apps/autogenpb + + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` // `autogenpb:uuid:1e3a50c7-5916-4423-b33c-f0b977a7e446` + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // `autogenpb:version:v0.0.1` + EventSize int64 `protobuf:"varint,3,opt,name=event_size,json=eventSize,proto3" json:"event_size,omitempty"` // max events to store in a single + Events []*Event `protobuf:"bytes,4,rep,name=events,proto3" json:"events,omitempty"` // all the events +} + +func (x *Events) Reset() { + *x = Events{} + mi := &file_event_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Events) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Events) ProtoMessage() {} + +func (x *Events) ProtoReflect() protoreflect.Message { + mi := &file_event_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Events.ProtoReflect.Descriptor instead. +func (*Events) Descriptor() ([]byte, []int) { + return file_event_proto_rawDescGZIP(), []int{0} +} + +func (x *Events) GetUuid() string { + if x != nil { + return x.Uuid + } + return "" +} + +func (x *Events) GetVersion() string { + if x != nil { + return x.Version + } + return "" +} + +func (x *Events) GetEventSize() int64 { + if x != nil { + return x.EventSize + } + return 0 +} + +func (x *Events) GetEvents() []*Event { + if x != nil { + return x.Events + } + return nil +} + +// this information leans towards being human readable not programatic +// in other words, it's better to just have the droplet name here rather than the uuid +// at least for now in the early days. but maybe forever. +// homelab clouds normally don't have many events. +// we are talking less than 1 a minute. even 1 an hour is often a lot +type Event struct { + sync.RWMutex // auto-added by go.wit.com/apps/autogenpb + + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // `autogenpb:unique` // should be unique across the cluster + Etype EventType `protobuf:"varint,2,opt,name=etype,proto3,enum=virtbuf.EventType" json:"etype,omitempty"` + Droplet string `protobuf:"bytes,3,opt,name=droplet,proto3" json:"droplet,omitempty"` // name of the droplet + DropletUuid string `protobuf:"bytes,4,opt,name=droplet_uuid,json=dropletUuid,proto3" json:"droplet_uuid,omitempty"` // uuid of the droplet + Hypervisor string `protobuf:"bytes,5,opt,name=hypervisor,proto3" json:"hypervisor,omitempty"` // name of the hypervisor + HypervisorUuid string `protobuf:"bytes,6,opt,name=hypervisor_uuid,json=hypervisorUuid,proto3" json:"hypervisor_uuid,omitempty"` // uuid of the hypervisor + Start *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=start,proto3" json:"start,omitempty"` // start time + End *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=end,proto3" json:"end,omitempty"` // end time + FieldName string `protobuf:"bytes,9,opt,name=field_name,json=fieldName,proto3" json:"field_name,omitempty"` // the field name that changed + OrigVal string `protobuf:"bytes,10,opt,name=orig_val,json=origVal,proto3" json:"orig_val,omitempty"` // original value + NewVal string `protobuf:"bytes,11,opt,name=new_val,json=newVal,proto3" json:"new_val,omitempty"` // new value + OrigAny *anypb.Any `protobuf:"bytes,12,opt,name=orig_any,json=origAny,proto3" json:"orig_any,omitempty"` // anypb format. probably overkill + NewAny *anypb.Any `protobuf:"bytes,13,opt,name=new_any,json=newAny,proto3" json:"new_any,omitempty"` // anypb format +} + +func (x *Event) Reset() { + *x = Event{} + mi := &file_event_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Event) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Event) ProtoMessage() {} + +func (x *Event) ProtoReflect() protoreflect.Message { + mi := &file_event_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Event.ProtoReflect.Descriptor instead. +func (*Event) Descriptor() ([]byte, []int) { + return file_event_proto_rawDescGZIP(), []int{1} +} + +func (x *Event) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Event) GetEtype() EventType { + if x != nil { + return x.Etype + } + return EventType_ADD +} + +func (x *Event) GetDroplet() string { + if x != nil { + return x.Droplet + } + return "" +} + +func (x *Event) GetDropletUuid() string { + if x != nil { + return x.DropletUuid + } + return "" +} + +func (x *Event) GetHypervisor() string { + if x != nil { + return x.Hypervisor + } + return "" +} + +func (x *Event) GetHypervisorUuid() string { + if x != nil { + return x.HypervisorUuid + } + return "" +} + +func (x *Event) GetStart() *timestamppb.Timestamp { + if x != nil { + return x.Start + } + return nil +} + +func (x *Event) GetEnd() *timestamppb.Timestamp { + if x != nil { + return x.End + } + return nil +} + +func (x *Event) GetFieldName() string { + if x != nil { + return x.FieldName + } + return "" +} + +func (x *Event) GetOrigVal() string { + if x != nil { + return x.OrigVal + } + return "" +} + +func (x *Event) GetNewVal() string { + if x != nil { + return x.NewVal + } + return "" +} + +func (x *Event) GetOrigAny() *anypb.Any { + if x != nil { + return x.OrigAny + } + return nil +} + +func (x *Event) GetNewAny() *anypb.Any { + if x != nil { + return x.NewAny + } + return nil +} + +var File_event_proto protoreflect.FileDescriptor + +var file_event_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x76, + 0x69, 0x72, 0x74, 0x62, 0x75, 0x66, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x7d, 0x0a, 0x06, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x12, 0x0a, 0x04, + 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, + 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x76, + 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, + 0x65, 0x76, 0x65, 0x6e, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x26, 0x0a, 0x06, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x76, 0x69, 0x72, 0x74, + 0x62, 0x75, 0x66, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, + 0x73, 0x22, 0xda, 0x03, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x05, 0x65, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x76, 0x69, 0x72, + 0x74, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, + 0x65, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x12, + 0x21, 0x0a, 0x0c, 0x64, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x5f, 0x75, 0x75, 0x69, 0x64, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x55, 0x75, + 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, + 0x6f, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, + 0x5f, 0x75, 0x75, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x68, 0x79, 0x70, + 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x55, 0x75, 0x69, 0x64, 0x12, 0x30, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x05, 0x73, 0x74, 0x61, 0x72, 0x74, 0x12, 0x2c, 0x0a, + 0x03, 0x65, 0x6e, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x03, 0x65, 0x6e, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x66, + 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, + 0x69, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, + 0x69, 0x67, 0x56, 0x61, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x65, 0x77, 0x5f, 0x76, 0x61, 0x6c, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x65, 0x77, 0x56, 0x61, 0x6c, 0x12, 0x2f, + 0x0a, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x5f, 0x61, 0x6e, 0x79, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x6f, 0x72, 0x69, 0x67, 0x41, 0x6e, 0x79, 0x12, + 0x2d, 0x0a, 0x07, 0x6e, 0x65, 0x77, 0x5f, 0x61, 0x6e, 0x79, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x06, 0x6e, 0x65, 0x77, 0x41, 0x6e, 0x79, 0x2a, 0x9e, + 0x01, 0x0a, 0x09, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, + 0x41, 0x44, 0x44, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, + 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x4f, 0x57, 0x45, 0x52, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x0c, + 0x0a, 0x08, 0x50, 0x4f, 0x57, 0x45, 0x52, 0x4f, 0x46, 0x46, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, + 0x48, 0x49, 0x42, 0x45, 0x52, 0x4e, 0x41, 0x54, 0x45, 0x10, 0x04, 0x12, 0x0b, 0x0a, 0x07, 0x4d, + 0x49, 0x47, 0x52, 0x41, 0x54, 0x45, 0x10, 0x05, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x45, 0x4d, 0x4f, + 0x10, 0x06, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x45, 0x54, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x4c, + 0x4f, 0x47, 0x49, 0x4e, 0x10, 0x08, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x09, 0x12, 0x08, + 0x0a, 0x04, 0x46, 0x41, 0x49, 0x4c, 0x10, 0x0a, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x52, 0x41, 0x53, + 0x48, 0x10, 0x0b, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x10, 0x0c, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_event_proto_rawDescOnce sync.Once + file_event_proto_rawDescData = file_event_proto_rawDesc +) + +func file_event_proto_rawDescGZIP() []byte { + file_event_proto_rawDescOnce.Do(func() { + file_event_proto_rawDescData = protoimpl.X.CompressGZIP(file_event_proto_rawDescData) + }) + return file_event_proto_rawDescData +} + +var file_event_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_event_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_event_proto_goTypes = []any{ + (EventType)(0), // 0: virtbuf.EventType + (*Events)(nil), // 1: virtbuf.Events + (*Event)(nil), // 2: virtbuf.Event + (*timestamppb.Timestamp)(nil), // 3: google.protobuf.Timestamp + (*anypb.Any)(nil), // 4: google.protobuf.Any +} +var file_event_proto_depIdxs = []int32{ + 2, // 0: virtbuf.Events.events:type_name -> virtbuf.Event + 0, // 1: virtbuf.Event.etype:type_name -> virtbuf.EventType + 3, // 2: virtbuf.Event.start:type_name -> google.protobuf.Timestamp + 3, // 3: virtbuf.Event.end:type_name -> google.protobuf.Timestamp + 4, // 4: virtbuf.Event.orig_any:type_name -> google.protobuf.Any + 4, // 5: virtbuf.Event.new_any:type_name -> google.protobuf.Any + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_event_proto_init() } +func file_event_proto_init() { + if File_event_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_event_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_event_proto_goTypes, + DependencyIndexes: file_event_proto_depIdxs, + EnumInfos: file_event_proto_enumTypes, + MessageInfos: file_event_proto_msgTypes, + }.Build() + File_event_proto = out.File + file_event_proto_rawDesc = nil + file_event_proto_goTypes = nil + file_event_proto_depIdxs = nil +}