3413 lines
102 KiB
Plaintext
3413 lines
102 KiB
Plaintext
// `autogen:go.mod`
|
|
|
|
module go.wit.com/lib/protobuf/virtbuf
|
|
|
|
go 1.22
|
|
|
|
toolchain go1.23.4
|
|
|
|
require (
|
|
github.com/google/uuid v1.6.0
|
|
go.wit.com/log v0.22.11
|
|
google.golang.org/protobuf v1.36.5
|
|
)
|
|
|
|
// `autogen:go.sum`
|
|
|
|
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
|
go.wit.com/log v0.22.11 h1:BiJe+S81kWrMqW1QyZVu1Es2d//WG9FAcZQEhZkkM4c=
|
|
go.wit.com/log v0.22.11/go.mod h1:LsP0nAH4hZEf2qj/F5UmGQT0OEJ3Q5698/P8ZOI2JuE=
|
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
|
|
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
|
|
|
|
// `autogen:droplet.marshal.pb.go`
|
|
|
|
// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT.
|
|
// This file was autogenerated with autogenpb v0.0.50 2025-02-07_10:22:09_UTC
|
|
// go install go.wit.com/apps/autogenpb@latest
|
|
//
|
|
// define which structs (messages) you want to use in the .proto file
|
|
// Then sort.pb.go and marshal.pb.go files are autogenerated
|
|
//
|
|
// autogenpb uses it and has an example .proto file with instructions
|
|
//
|
|
|
|
package virtbuf
|
|
|
|
import (
|
|
"google.golang.org/protobuf/encoding/protojson"
|
|
"google.golang.org/protobuf/encoding/prototext"
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
// human readable JSON
|
|
func (v *Droplets) FormatJSON() string {
|
|
return protojson.Format(v)
|
|
}
|
|
|
|
// marshal json
|
|
func (v *Droplets) MarshalJSON() ([]byte, error) {
|
|
return protojson.Marshal(v)
|
|
}
|
|
|
|
// unmarshal json
|
|
func (v *Droplets) UnmarshalJSON(data []byte) error {
|
|
return protojson.Unmarshal(data, v)
|
|
}
|
|
|
|
// apparently this isn't stable, but it's awesomely better
|
|
// https://protobuf.dev/reference/go/faq/#unstable-text
|
|
// it's brilliant for config files!
|
|
func (v *Droplets) FormatTEXT() string {
|
|
v.fixUuid()
|
|
return prototext.Format(v)
|
|
}
|
|
|
|
// unmarshalTEXT. This reads the .text config file back in after the user edits it
|
|
func (v *Droplets) UnmarshalTEXT(data []byte) error {
|
|
return prototext.Unmarshal(data, v)
|
|
}
|
|
|
|
// marshal to wire. This is called winning.
|
|
func (v *Droplets) Marshal() ([]byte, error) {
|
|
v.fixUuid()
|
|
return proto.Marshal(v)
|
|
}
|
|
|
|
// unmarshal from wire. You have won.
|
|
func (v *Droplets) Unmarshal(data []byte) error {
|
|
return proto.Unmarshal(data, v)
|
|
}
|
|
|
|
// human readable JSON
|
|
func (v *Droplet) FormatJSON() string {
|
|
return protojson.Format(v)
|
|
}
|
|
|
|
// marshal json
|
|
func (v *Droplet) MarshalJSON() ([]byte, error) {
|
|
return protojson.Marshal(v)
|
|
}
|
|
|
|
// unmarshal json
|
|
func (v *Droplet) UnmarshalJSON(data []byte) error {
|
|
return protojson.Unmarshal(data, v)
|
|
}
|
|
|
|
// apparently this isn't stable, but it's awesomely better
|
|
// https://protobuf.dev/reference/go/faq/#unstable-text
|
|
// it's brilliant for config files!
|
|
func (v *Droplet) FormatTEXT() string {
|
|
return prototext.Format(v)
|
|
}
|
|
|
|
// unmarshalTEXT. This reads the .text config file back in after the user edits it
|
|
func (v *Droplet) UnmarshalTEXT(data []byte) error {
|
|
return prototext.Unmarshal(data, v)
|
|
}
|
|
|
|
// marshal to wire. This is called winning.
|
|
func (v *Droplet) Marshal() ([]byte, error) {
|
|
return proto.Marshal(v)
|
|
}
|
|
|
|
// unmarshal from wire. You have won.
|
|
func (v *Droplet) Unmarshal(data []byte) error {
|
|
return proto.Unmarshal(data, v)
|
|
}
|
|
|
|
// `autogen:droplet.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: droplet.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"
|
|
durationpb "google.golang.org/protobuf/types/known/durationpb"
|
|
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)
|
|
)
|
|
|
|
// virtual machine state
|
|
type DropletState int32
|
|
|
|
const (
|
|
DropletState_ON DropletState = 0
|
|
DropletState_OFF DropletState = 1
|
|
DropletState_UNKNOWN DropletState = 2 // qemu says 'Shutdown'
|
|
DropletState_PAUSED DropletState = 3
|
|
DropletState_CRASHED DropletState = 4
|
|
DropletState_INMIGRATE DropletState = 5
|
|
)
|
|
|
|
// Enum value maps for DropletState.
|
|
var (
|
|
DropletState_name = map[int32]string{
|
|
0: "ON",
|
|
1: "OFF",
|
|
2: "UNKNOWN",
|
|
3: "PAUSED",
|
|
4: "CRASHED",
|
|
5: "INMIGRATE",
|
|
}
|
|
DropletState_value = map[string]int32{
|
|
"ON": 0,
|
|
"OFF": 1,
|
|
"UNKNOWN": 2,
|
|
"PAUSED": 3,
|
|
"CRASHED": 4,
|
|
"INMIGRATE": 5,
|
|
}
|
|
)
|
|
|
|
func (x DropletState) Enum() *DropletState {
|
|
p := new(DropletState)
|
|
*p = x
|
|
return p
|
|
}
|
|
|
|
func (x DropletState) String() string {
|
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
|
}
|
|
|
|
func (DropletState) Descriptor() protoreflect.EnumDescriptor {
|
|
return file_droplet_proto_enumTypes[0].Descriptor()
|
|
}
|
|
|
|
func (DropletState) Type() protoreflect.EnumType {
|
|
return &file_droplet_proto_enumTypes[0]
|
|
}
|
|
|
|
func (x DropletState) Number() protoreflect.EnumNumber {
|
|
return protoreflect.EnumNumber(x)
|
|
}
|
|
|
|
// Deprecated: Use DropletState.Descriptor instead.
|
|
func (DropletState) EnumDescriptor() ([]byte, []int) {
|
|
return file_droplet_proto_rawDescGZIP(), []int{0}
|
|
}
|
|
|
|
type DropletArchive int32
|
|
|
|
const (
|
|
DropletArchive_DUP DropletArchive = 0
|
|
DropletArchive_USER DropletArchive = 1
|
|
)
|
|
|
|
// Enum value maps for DropletArchive.
|
|
var (
|
|
DropletArchive_name = map[int32]string{
|
|
0: "DUP",
|
|
1: "USER",
|
|
}
|
|
DropletArchive_value = map[string]int32{
|
|
"DUP": 0,
|
|
"USER": 1,
|
|
}
|
|
)
|
|
|
|
func (x DropletArchive) Enum() *DropletArchive {
|
|
p := new(DropletArchive)
|
|
*p = x
|
|
return p
|
|
}
|
|
|
|
func (x DropletArchive) String() string {
|
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
|
}
|
|
|
|
func (DropletArchive) Descriptor() protoreflect.EnumDescriptor {
|
|
return file_droplet_proto_enumTypes[1].Descriptor()
|
|
}
|
|
|
|
func (DropletArchive) Type() protoreflect.EnumType {
|
|
return &file_droplet_proto_enumTypes[1]
|
|
}
|
|
|
|
func (x DropletArchive) Number() protoreflect.EnumNumber {
|
|
return protoreflect.EnumNumber(x)
|
|
}
|
|
|
|
// Deprecated: Use DropletArchive.Descriptor instead.
|
|
func (DropletArchive) EnumDescriptor() ([]byte, []int) {
|
|
return file_droplet_proto_rawDescGZIP(), []int{1}
|
|
}
|
|
|
|
type Droplets 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:d5d492e2-38d4-476b-86f3-f5abf01f9d6d`
|
|
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // `autogenpb:version:v0.0.1`
|
|
Droplets []*Droplet `protobuf:"bytes,3,rep,name=droplets,proto3" json:"droplets,omitempty"`
|
|
}
|
|
|
|
func (x *Droplets) Reset() {
|
|
*x = Droplets{}
|
|
mi := &file_droplet_proto_msgTypes[0]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *Droplets) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*Droplets) ProtoMessage() {}
|
|
|
|
func (x *Droplets) ProtoReflect() protoreflect.Message {
|
|
mi := &file_droplet_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 Droplets.ProtoReflect.Descriptor instead.
|
|
func (*Droplets) Descriptor() ([]byte, []int) {
|
|
return file_droplet_proto_rawDescGZIP(), []int{0}
|
|
}
|
|
|
|
func (x *Droplets) GetUuid() string {
|
|
if x != nil {
|
|
return x.Uuid
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Droplets) GetVersion() string {
|
|
if x != nil {
|
|
return x.Version
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Droplets) GetDroplets() []*Droplet {
|
|
if x != nil {
|
|
return x.Droplets
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type Droplet 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:unique` // should be unique across the cluster
|
|
Hostname string `protobuf:"bytes,2,opt,name=hostname,proto3" json:"hostname,omitempty"` // `autogenpb:unique` // should be unique and work in DNS
|
|
Cpus int64 `protobuf:"varint,3,opt,name=cpus,proto3" json:"cpus,omitempty"` // what's the point of int64 vs int32
|
|
Memory int64 `protobuf:"varint,4,opt,name=memory,proto3" json:"memory,omitempty"` // in bytes
|
|
Current *Current `protobuf:"bytes,5,opt,name=current,proto3" json:"current,omitempty"` // what the state and values of the droplet is
|
|
StartState DropletState `protobuf:"varint,6,opt,name=start_state,json=startState,proto3,enum=virtbuf.DropletState" json:"start_state,omitempty"` // what the state of the droplet is SUPPOSED TO BE ('on' or 'off')
|
|
QemuMachine string `protobuf:"bytes,7,opt,name=qemu_machine,json=qemuMachine,proto3" json:"qemu_machine,omitempty"` // the qemu machine type to use "pc-q35-9.0"
|
|
SpicePort int64 `protobuf:"varint,8,opt,name=spice_port,json=spicePort,proto3" json:"spice_port,omitempty"` // preferred port to use for spice
|
|
PreferredHypervisor string `protobuf:"bytes,9,opt,name=preferred_hypervisor,json=preferredHypervisor,proto3" json:"preferred_hypervisor,omitempty"` // the hypervisor to prefer to run the droplet on
|
|
ForceHypervisor string `protobuf:"bytes,10,opt,name=force_hypervisor,json=forceHypervisor,proto3" json:"force_hypervisor,omitempty"` // use this hypervisor and this hypervisor only
|
|
PreferredArch string `protobuf:"bytes,11,opt,name=preferred_arch,json=preferredArch,proto3" json:"preferred_arch,omitempty"` // the cpu arch to use "x86_64" (should really get this from the disk?)
|
|
Networks []*Network `protobuf:"bytes,12,rep,name=networks,proto3" json:"networks,omitempty"` // really just mac addresses. should be unique across cluster
|
|
Disks []*Disk `protobuf:"bytes,13,rep,name=disks,proto3" json:"disks,omitempty"` // disks to attach
|
|
LocalOnly string `protobuf:"bytes,14,opt,name=local_only,json=localOnly,proto3" json:"local_only,omitempty"` // this is only defined locally on the hypervisor
|
|
CustomXml string `protobuf:"bytes,15,opt,name=custom_xml,json=customXml,proto3" json:"custom_xml,omitempty"` // if needed,
|
|
Archive *Archive `protobuf:"bytes,16,opt,name=archive,proto3" json:"archive,omitempty"` // what the state of the droplet is SUPPOSED TO BE ('on' or 'off')
|
|
Unstable *timestamppb.Timestamp `protobuf:"bytes,39,opt,name=unstable,proto3" json:"unstable,omitempty"` // the last time we heard anything from this droplet
|
|
UnstableTimeout *durationpb.Duration `protobuf:"bytes,40,opt,name=unstable_timeout,json=unstableTimeout,proto3" json:"unstable_timeout,omitempty"` // the last time we heard anything from this droplet
|
|
}
|
|
|
|
func (x *Droplet) Reset() {
|
|
*x = Droplet{}
|
|
mi := &file_droplet_proto_msgTypes[1]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *Droplet) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*Droplet) ProtoMessage() {}
|
|
|
|
func (x *Droplet) ProtoReflect() protoreflect.Message {
|
|
mi := &file_droplet_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 Droplet.ProtoReflect.Descriptor instead.
|
|
func (*Droplet) Descriptor() ([]byte, []int) {
|
|
return file_droplet_proto_rawDescGZIP(), []int{1}
|
|
}
|
|
|
|
func (x *Droplet) GetUuid() string {
|
|
if x != nil {
|
|
return x.Uuid
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Droplet) GetHostname() string {
|
|
if x != nil {
|
|
return x.Hostname
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Droplet) GetCpus() int64 {
|
|
if x != nil {
|
|
return x.Cpus
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *Droplet) GetMemory() int64 {
|
|
if x != nil {
|
|
return x.Memory
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *Droplet) GetCurrent() *Current {
|
|
if x != nil {
|
|
return x.Current
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *Droplet) GetStartState() DropletState {
|
|
if x != nil {
|
|
return x.StartState
|
|
}
|
|
return DropletState_ON
|
|
}
|
|
|
|
func (x *Droplet) GetQemuMachine() string {
|
|
if x != nil {
|
|
return x.QemuMachine
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Droplet) GetSpicePort() int64 {
|
|
if x != nil {
|
|
return x.SpicePort
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *Droplet) GetPreferredHypervisor() string {
|
|
if x != nil {
|
|
return x.PreferredHypervisor
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Droplet) GetForceHypervisor() string {
|
|
if x != nil {
|
|
return x.ForceHypervisor
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Droplet) GetPreferredArch() string {
|
|
if x != nil {
|
|
return x.PreferredArch
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Droplet) GetNetworks() []*Network {
|
|
if x != nil {
|
|
return x.Networks
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *Droplet) GetDisks() []*Disk {
|
|
if x != nil {
|
|
return x.Disks
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *Droplet) GetLocalOnly() string {
|
|
if x != nil {
|
|
return x.LocalOnly
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Droplet) GetCustomXml() string {
|
|
if x != nil {
|
|
return x.CustomXml
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Droplet) GetArchive() *Archive {
|
|
if x != nil {
|
|
return x.Archive
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *Droplet) GetUnstable() *timestamppb.Timestamp {
|
|
if x != nil {
|
|
return x.Unstable
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *Droplet) GetUnstableTimeout() *durationpb.Duration {
|
|
if x != nil {
|
|
return x.UnstableTimeout
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// volatile data. the current settings and values of things.
|
|
// These are passed around while the cluster to monitor and control the systems
|
|
// but they are not saved to the config file
|
|
type Current struct {
|
|
sync.RWMutex // auto-added by go.wit.com/apps/autogenpb
|
|
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
State DropletState `protobuf:"varint,1,opt,name=state,proto3,enum=virtbuf.DropletState" json:"state,omitempty"` // used to track the current state before taking any action
|
|
Hypervisor string `protobuf:"bytes,2,opt,name=hypervisor,proto3" json:"hypervisor,omitempty"` // the current hypervisor the droplet is running on
|
|
StartAttempts int64 `protobuf:"varint,3,opt,name=start_attempts,json=startAttempts,proto3" json:"start_attempts,omitempty"` // how many times a start has been attempted
|
|
FullXml string `protobuf:"bytes,4,opt,name=full_xml,json=fullXml,proto3" json:"full_xml,omitempty"` // the full libvirt xml to import
|
|
LastPoll *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=last_poll,json=lastPoll,proto3" json:"last_poll,omitempty"` // the last time we heard anything from this droplet
|
|
ImageUrl string `protobuf:"bytes,6,opt,name=image_url,json=imageUrl,proto3" json:"image_url,omitempty"` // url to the image
|
|
OffSince *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=off_since,json=offSince,proto3" json:"off_since,omitempty"` // when the droplet was turned off
|
|
OnSince *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=on_since,json=onSince,proto3" json:"on_since,omitempty"` // when the droplet was turned on
|
|
}
|
|
|
|
func (x *Current) Reset() {
|
|
*x = Current{}
|
|
mi := &file_droplet_proto_msgTypes[2]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *Current) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*Current) ProtoMessage() {}
|
|
|
|
func (x *Current) ProtoReflect() protoreflect.Message {
|
|
mi := &file_droplet_proto_msgTypes[2]
|
|
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 Current.ProtoReflect.Descriptor instead.
|
|
func (*Current) Descriptor() ([]byte, []int) {
|
|
return file_droplet_proto_rawDescGZIP(), []int{2}
|
|
}
|
|
|
|
func (x *Current) GetState() DropletState {
|
|
if x != nil {
|
|
return x.State
|
|
}
|
|
return DropletState_ON
|
|
}
|
|
|
|
func (x *Current) GetHypervisor() string {
|
|
if x != nil {
|
|
return x.Hypervisor
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Current) GetStartAttempts() int64 {
|
|
if x != nil {
|
|
return x.StartAttempts
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *Current) GetFullXml() string {
|
|
if x != nil {
|
|
return x.FullXml
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Current) GetLastPoll() *timestamppb.Timestamp {
|
|
if x != nil {
|
|
return x.LastPoll
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *Current) GetImageUrl() string {
|
|
if x != nil {
|
|
return x.ImageUrl
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Current) GetOffSince() *timestamppb.Timestamp {
|
|
if x != nil {
|
|
return x.OffSince
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *Current) GetOnSince() *timestamppb.Timestamp {
|
|
if x != nil {
|
|
return x.OnSince
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type Archive struct {
|
|
sync.RWMutex // auto-added by go.wit.com/apps/autogenpb
|
|
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
Reason DropletArchive `protobuf:"varint,1,opt,name=reason,proto3,enum=virtbuf.DropletArchive" json:"reason,omitempty"` // why the droplet was archived
|
|
When *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=when,proto3" json:"when,omitempty"` // when it was archived
|
|
}
|
|
|
|
func (x *Archive) Reset() {
|
|
*x = Archive{}
|
|
mi := &file_droplet_proto_msgTypes[3]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *Archive) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*Archive) ProtoMessage() {}
|
|
|
|
func (x *Archive) ProtoReflect() protoreflect.Message {
|
|
mi := &file_droplet_proto_msgTypes[3]
|
|
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 Archive.ProtoReflect.Descriptor instead.
|
|
func (*Archive) Descriptor() ([]byte, []int) {
|
|
return file_droplet_proto_rawDescGZIP(), []int{3}
|
|
}
|
|
|
|
func (x *Archive) GetReason() DropletArchive {
|
|
if x != nil {
|
|
return x.Reason
|
|
}
|
|
return DropletArchive_DUP
|
|
}
|
|
|
|
func (x *Archive) GetWhen() *timestamppb.Timestamp {
|
|
if x != nil {
|
|
return x.When
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type Network struct {
|
|
sync.RWMutex // auto-added by go.wit.com/apps/autogenpb
|
|
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
Mac string `protobuf:"bytes,1,opt,name=mac,proto3" json:"mac,omitempty"`
|
|
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
|
}
|
|
|
|
func (x *Network) Reset() {
|
|
*x = Network{}
|
|
mi := &file_droplet_proto_msgTypes[4]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *Network) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*Network) ProtoMessage() {}
|
|
|
|
func (x *Network) ProtoReflect() protoreflect.Message {
|
|
mi := &file_droplet_proto_msgTypes[4]
|
|
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 Network.ProtoReflect.Descriptor instead.
|
|
func (*Network) Descriptor() ([]byte, []int) {
|
|
return file_droplet_proto_rawDescGZIP(), []int{4}
|
|
}
|
|
|
|
func (x *Network) GetMac() string {
|
|
if x != nil {
|
|
return x.Mac
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Network) GetName() string {
|
|
if x != nil {
|
|
return x.Name
|
|
}
|
|
return ""
|
|
}
|
|
|
|
type Disk struct {
|
|
sync.RWMutex // auto-added by go.wit.com/apps/autogenpb
|
|
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"`
|
|
Filepath string `protobuf:"bytes,2,opt,name=filepath,proto3" json:"filepath,omitempty"`
|
|
Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`
|
|
QemuArch string `protobuf:"bytes,4,opt,name=qemu_arch,json=qemuArch,proto3" json:"qemu_arch,omitempty"` // what arch. example: "x86_64" or "riscv64"
|
|
}
|
|
|
|
func (x *Disk) Reset() {
|
|
*x = Disk{}
|
|
mi := &file_droplet_proto_msgTypes[5]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *Disk) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*Disk) ProtoMessage() {}
|
|
|
|
func (x *Disk) ProtoReflect() protoreflect.Message {
|
|
mi := &file_droplet_proto_msgTypes[5]
|
|
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 Disk.ProtoReflect.Descriptor instead.
|
|
func (*Disk) Descriptor() ([]byte, []int) {
|
|
return file_droplet_proto_rawDescGZIP(), []int{5}
|
|
}
|
|
|
|
func (x *Disk) GetFilename() string {
|
|
if x != nil {
|
|
return x.Filename
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Disk) GetFilepath() string {
|
|
if x != nil {
|
|
return x.Filepath
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Disk) GetSize() int64 {
|
|
if x != nil {
|
|
return x.Size
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *Disk) GetQemuArch() string {
|
|
if x != nil {
|
|
return x.QemuArch
|
|
}
|
|
return ""
|
|
}
|
|
|
|
var File_droplet_proto protoreflect.FileDescriptor
|
|
|
|
var file_droplet_proto_rawDesc = []byte{
|
|
0x0a, 0x0d, 0x64, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
|
0x07, 0x76, 0x69, 0x72, 0x74, 0x62, 0x75, 0x66, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
|
|
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69,
|
|
0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 0x22, 0x66, 0x0a, 0x08, 0x44, 0x72, 0x6f,
|
|
0x70, 0x6c, 0x65, 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, 0x2c, 0x0a, 0x08, 0x64, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x73, 0x18,
|
|
0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x76, 0x69, 0x72, 0x74, 0x62, 0x75, 0x66, 0x2e,
|
|
0x44, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x52, 0x08, 0x64, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74,
|
|
0x73, 0x22, 0xcb, 0x05, 0x0a, 0x07, 0x44, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x12, 0x12, 0x0a,
|
|
0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69,
|
|
0x64, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20,
|
|
0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a,
|
|
0x04, 0x63, 0x70, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x70, 0x75,
|
|
0x73, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28,
|
|
0x03, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x2a, 0x0a, 0x07, 0x63, 0x75, 0x72,
|
|
0x72, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x76, 0x69, 0x72,
|
|
0x74, 0x62, 0x75, 0x66, 0x2e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x52, 0x07, 0x63, 0x75,
|
|
0x72, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x36, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x73,
|
|
0x74, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x76, 0x69, 0x72,
|
|
0x74, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74,
|
|
0x65, 0x52, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x21, 0x0a,
|
|
0x0c, 0x71, 0x65, 0x6d, 0x75, 0x5f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x18, 0x07, 0x20,
|
|
0x01, 0x28, 0x09, 0x52, 0x0b, 0x71, 0x65, 0x6d, 0x75, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65,
|
|
0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x70, 0x69, 0x63, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x08,
|
|
0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x70, 0x69, 0x63, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x12,
|
|
0x31, 0x0a, 0x14, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x5f, 0x68, 0x79, 0x70,
|
|
0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x70,
|
|
0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x48, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73,
|
|
0x6f, 0x72, 0x12, 0x29, 0x0a, 0x10, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x5f, 0x68, 0x79, 0x70, 0x65,
|
|
0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x66, 0x6f,
|
|
0x72, 0x63, 0x65, 0x48, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x12, 0x25, 0x0a,
|
|
0x0e, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x18,
|
|
0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x72, 0x65, 0x64,
|
|
0x41, 0x72, 0x63, 0x68, 0x12, 0x2c, 0x0a, 0x08, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x73,
|
|
0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x76, 0x69, 0x72, 0x74, 0x62, 0x75, 0x66,
|
|
0x2e, 0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x52, 0x08, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72,
|
|
0x6b, 0x73, 0x12, 0x23, 0x0a, 0x05, 0x64, 0x69, 0x73, 0x6b, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28,
|
|
0x0b, 0x32, 0x0d, 0x2e, 0x76, 0x69, 0x72, 0x74, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x69, 0x73, 0x6b,
|
|
0x52, 0x05, 0x64, 0x69, 0x73, 0x6b, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
|
|
0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c, 0x6f, 0x63,
|
|
0x61, 0x6c, 0x4f, 0x6e, 0x6c, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d,
|
|
0x5f, 0x78, 0x6d, 0x6c, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x75, 0x73, 0x74,
|
|
0x6f, 0x6d, 0x58, 0x6d, 0x6c, 0x12, 0x2a, 0x0a, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65,
|
|
0x18, 0x10, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x76, 0x69, 0x72, 0x74, 0x62, 0x75, 0x66,
|
|
0x2e, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x52, 0x07, 0x61, 0x72, 0x63, 0x68, 0x69, 0x76,
|
|
0x65, 0x12, 0x36, 0x0a, 0x08, 0x75, 0x6e, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x27, 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,
|
|
0x08, 0x75, 0x6e, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x75, 0x6e, 0x73,
|
|
0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x28, 0x20,
|
|
0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
|
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0f,
|
|
0x75, 0x6e, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22,
|
|
0xde, 0x02, 0x0a, 0x07, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x12, 0x2b, 0x0a, 0x05, 0x73,
|
|
0x74, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x76, 0x69, 0x72,
|
|
0x74, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74,
|
|
0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x68, 0x79, 0x70, 0x65,
|
|
0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x68, 0x79,
|
|
0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x72,
|
|
0x74, 0x5f, 0x61, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03,
|
|
0x52, 0x0d, 0x73, 0x74, 0x61, 0x72, 0x74, 0x41, 0x74, 0x74, 0x65, 0x6d, 0x70, 0x74, 0x73, 0x12,
|
|
0x19, 0x0a, 0x08, 0x66, 0x75, 0x6c, 0x6c, 0x5f, 0x78, 0x6d, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28,
|
|
0x09, 0x52, 0x07, 0x66, 0x75, 0x6c, 0x6c, 0x58, 0x6d, 0x6c, 0x12, 0x37, 0x0a, 0x09, 0x6c, 0x61,
|
|
0x73, 0x74, 0x5f, 0x70, 0x6f, 0x6c, 0x6c, 0x18, 0x05, 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, 0x08, 0x6c, 0x61, 0x73, 0x74, 0x50,
|
|
0x6f, 0x6c, 0x6c, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x5f, 0x75, 0x72, 0x6c,
|
|
0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x55, 0x72, 0x6c,
|
|
0x12, 0x37, 0x0a, 0x09, 0x6f, 0x66, 0x66, 0x5f, 0x73, 0x69, 0x6e, 0x63, 0x65, 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,
|
|
0x08, 0x6f, 0x66, 0x66, 0x53, 0x69, 0x6e, 0x63, 0x65, 0x12, 0x35, 0x0a, 0x08, 0x6f, 0x6e, 0x5f,
|
|
0x73, 0x69, 0x6e, 0x63, 0x65, 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, 0x07, 0x6f, 0x6e, 0x53, 0x69, 0x6e, 0x63, 0x65,
|
|
0x22, 0x6a, 0x0a, 0x07, 0x41, 0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x12, 0x2f, 0x0a, 0x06, 0x72,
|
|
0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x76, 0x69,
|
|
0x72, 0x74, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x41, 0x72, 0x63,
|
|
0x68, 0x69, 0x76, 0x65, 0x52, 0x06, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x2e, 0x0a, 0x04,
|
|
0x77, 0x68, 0x65, 0x6e, 0x18, 0x02, 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, 0x04, 0x77, 0x68, 0x65, 0x6e, 0x22, 0x2f, 0x0a, 0x07,
|
|
0x4e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x61, 0x63, 0x18, 0x01,
|
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x61, 0x63, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
|
|
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x6f, 0x0a,
|
|
0x04, 0x44, 0x69, 0x73, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d,
|
|
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d,
|
|
0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20,
|
|
0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x70, 0x61, 0x74, 0x68, 0x12, 0x12, 0x0a,
|
|
0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a,
|
|
0x65, 0x12, 0x1b, 0x0a, 0x09, 0x71, 0x65, 0x6d, 0x75, 0x5f, 0x61, 0x72, 0x63, 0x68, 0x18, 0x04,
|
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x71, 0x65, 0x6d, 0x75, 0x41, 0x72, 0x63, 0x68, 0x2a, 0x54,
|
|
0x0a, 0x0c, 0x44, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x06,
|
|
0x0a, 0x02, 0x4f, 0x4e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x4f, 0x46, 0x46, 0x10, 0x01, 0x12,
|
|
0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06,
|
|
0x50, 0x41, 0x55, 0x53, 0x45, 0x44, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x52, 0x41, 0x53,
|
|
0x48, 0x45, 0x44, 0x10, 0x04, 0x12, 0x0d, 0x0a, 0x09, 0x49, 0x4e, 0x4d, 0x49, 0x47, 0x52, 0x41,
|
|
0x54, 0x45, 0x10, 0x05, 0x2a, 0x23, 0x0a, 0x0e, 0x44, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x41,
|
|
0x72, 0x63, 0x68, 0x69, 0x76, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x55, 0x50, 0x10, 0x00, 0x12,
|
|
0x08, 0x0a, 0x04, 0x55, 0x53, 0x45, 0x52, 0x10, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
|
0x33,
|
|
}
|
|
|
|
var (
|
|
file_droplet_proto_rawDescOnce sync.Once
|
|
file_droplet_proto_rawDescData = file_droplet_proto_rawDesc
|
|
)
|
|
|
|
func file_droplet_proto_rawDescGZIP() []byte {
|
|
file_droplet_proto_rawDescOnce.Do(func() {
|
|
file_droplet_proto_rawDescData = protoimpl.X.CompressGZIP(file_droplet_proto_rawDescData)
|
|
})
|
|
return file_droplet_proto_rawDescData
|
|
}
|
|
|
|
var file_droplet_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
|
var file_droplet_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
|
var file_droplet_proto_goTypes = []any{
|
|
(DropletState)(0), // 0: virtbuf.DropletState
|
|
(DropletArchive)(0), // 1: virtbuf.DropletArchive
|
|
(*Droplets)(nil), // 2: virtbuf.Droplets
|
|
(*Droplet)(nil), // 3: virtbuf.Droplet
|
|
(*Current)(nil), // 4: virtbuf.Current
|
|
(*Archive)(nil), // 5: virtbuf.Archive
|
|
(*Network)(nil), // 6: virtbuf.Network
|
|
(*Disk)(nil), // 7: virtbuf.Disk
|
|
(*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp
|
|
(*durationpb.Duration)(nil), // 9: google.protobuf.Duration
|
|
}
|
|
var file_droplet_proto_depIdxs = []int32{
|
|
3, // 0: virtbuf.Droplets.droplets:type_name -> virtbuf.Droplet
|
|
4, // 1: virtbuf.Droplet.current:type_name -> virtbuf.Current
|
|
0, // 2: virtbuf.Droplet.start_state:type_name -> virtbuf.DropletState
|
|
6, // 3: virtbuf.Droplet.networks:type_name -> virtbuf.Network
|
|
7, // 4: virtbuf.Droplet.disks:type_name -> virtbuf.Disk
|
|
5, // 5: virtbuf.Droplet.archive:type_name -> virtbuf.Archive
|
|
8, // 6: virtbuf.Droplet.unstable:type_name -> google.protobuf.Timestamp
|
|
9, // 7: virtbuf.Droplet.unstable_timeout:type_name -> google.protobuf.Duration
|
|
0, // 8: virtbuf.Current.state:type_name -> virtbuf.DropletState
|
|
8, // 9: virtbuf.Current.last_poll:type_name -> google.protobuf.Timestamp
|
|
8, // 10: virtbuf.Current.off_since:type_name -> google.protobuf.Timestamp
|
|
8, // 11: virtbuf.Current.on_since:type_name -> google.protobuf.Timestamp
|
|
1, // 12: virtbuf.Archive.reason:type_name -> virtbuf.DropletArchive
|
|
8, // 13: virtbuf.Archive.when:type_name -> google.protobuf.Timestamp
|
|
14, // [14:14] is the sub-list for method output_type
|
|
14, // [14:14] is the sub-list for method input_type
|
|
14, // [14:14] is the sub-list for extension type_name
|
|
14, // [14:14] is the sub-list for extension extendee
|
|
0, // [0:14] is the sub-list for field type_name
|
|
}
|
|
|
|
func init() { file_droplet_proto_init() }
|
|
func file_droplet_proto_init() {
|
|
if File_droplet_proto != nil {
|
|
return
|
|
}
|
|
type x struct{}
|
|
out := protoimpl.TypeBuilder{
|
|
File: protoimpl.DescBuilder{
|
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
|
RawDescriptor: file_droplet_proto_rawDesc,
|
|
NumEnums: 2,
|
|
NumMessages: 6,
|
|
NumExtensions: 0,
|
|
NumServices: 0,
|
|
},
|
|
GoTypes: file_droplet_proto_goTypes,
|
|
DependencyIndexes: file_droplet_proto_depIdxs,
|
|
EnumInfos: file_droplet_proto_enumTypes,
|
|
MessageInfos: file_droplet_proto_msgTypes,
|
|
}.Build()
|
|
File_droplet_proto = out.File
|
|
file_droplet_proto_rawDesc = nil
|
|
file_droplet_proto_goTypes = nil
|
|
file_droplet_proto_depIdxs = nil
|
|
}
|
|
|
|
// `autogen:droplet.sort.pb.go`
|
|
|
|
// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT.
|
|
// This file was autogenerated with autogenpb v0.0.50 2025-02-07_10:22:09_UTC
|
|
// go install go.wit.com/apps/autogenpb@latest
|
|
//
|
|
// define which structs (messages) you want to use in the .proto file
|
|
// Then sort.pb.go and marshal.pb.go files are autogenerated
|
|
//
|
|
// autogenpb uses it and has an example .proto file with instructions
|
|
//
|
|
|
|
package virtbuf
|
|
|
|
import (
|
|
"fmt"
|
|
"sync"
|
|
)
|
|
|
|
// a simple global lock
|
|
var dropletMu sync.RWMutex
|
|
|
|
func (x *Droplets) fixUuid() {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Uuid == "d5d492e2-38d4-476b-86f3-f5abf01f9d6d" {
|
|
return
|
|
}
|
|
x.Uuid = "d5d492e2-38d4-476b-86f3-f5abf01f9d6d"
|
|
x.Version = "v0.0.1 go.wit.com/lib/protobuf/virtbuf"
|
|
}
|
|
|
|
func NewDroplets() *Droplets {
|
|
x := new(Droplets)
|
|
x.Uuid = "d5d492e2-38d4-476b-86f3-f5abf01f9d6d"
|
|
x.Version = "v0.0.1 go.wit.com/lib/protobuf/virtbuf"
|
|
return x
|
|
}
|
|
|
|
// START SORT
|
|
|
|
// DEFINE THE Droplets ITERATOR.
|
|
// itializes a new iterator.
|
|
func newDropletsIterator(things []*Droplets) *DropletsIterator {
|
|
return &DropletsIterator{things: things}
|
|
}
|
|
|
|
type DropletsIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*Droplets
|
|
index int
|
|
}
|
|
|
|
func (it *DropletsIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *DropletsIterator) Next() *Droplets {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in DropletsIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// DEFINE THE Droplet ITERATOR.
|
|
// itializes a new iterator.
|
|
func newDropletIterator(things []*Droplet) *DropletIterator {
|
|
return &DropletIterator{things: things}
|
|
}
|
|
|
|
type DropletIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*Droplet
|
|
index int
|
|
}
|
|
|
|
func (it *DropletIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *DropletIterator) Next() *Droplet {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in DropletIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// DEFINE THE Current ITERATOR.
|
|
// itializes a new iterator.
|
|
func newCurrentIterator(things []*Current) *CurrentIterator {
|
|
return &CurrentIterator{things: things}
|
|
}
|
|
|
|
type CurrentIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*Current
|
|
index int
|
|
}
|
|
|
|
func (it *CurrentIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *CurrentIterator) Next() *Current {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in CurrentIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// DEFINE THE Archive ITERATOR.
|
|
// itializes a new iterator.
|
|
func newArchiveIterator(things []*Archive) *ArchiveIterator {
|
|
return &ArchiveIterator{things: things}
|
|
}
|
|
|
|
type ArchiveIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*Archive
|
|
index int
|
|
}
|
|
|
|
func (it *ArchiveIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *ArchiveIterator) Next() *Archive {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in ArchiveIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// DEFINE THE Network ITERATOR.
|
|
// itializes a new iterator.
|
|
func newNetworkIterator(things []*Network) *NetworkIterator {
|
|
return &NetworkIterator{things: things}
|
|
}
|
|
|
|
type NetworkIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*Network
|
|
index int
|
|
}
|
|
|
|
func (it *NetworkIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *NetworkIterator) Next() *Network {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in NetworkIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// DEFINE THE Disk ITERATOR.
|
|
// itializes a new iterator.
|
|
func newDiskIterator(things []*Disk) *DiskIterator {
|
|
return &DiskIterator{things: things}
|
|
}
|
|
|
|
type DiskIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*Disk
|
|
index int
|
|
}
|
|
|
|
func (it *DiskIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *DiskIterator) Next() *Disk {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in DiskIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// safely returns a slice of pointers to the FRUIT protobufs
|
|
func (x *Droplets) allDroplets() []*Droplet {
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
// Create a new slice to hold pointers to each FRUIT
|
|
var tmp []*Droplet
|
|
tmp = make([]*Droplet, len(x.Droplets))
|
|
for i, p := range x.Droplets {
|
|
tmp[i] = p // Copy pointers for safe iteration
|
|
}
|
|
|
|
return tmp
|
|
}
|
|
|
|
// safely returns a slice of pointers to the FRUIT protobufs
|
|
func (x *Droplet) allNetworks() []*Network {
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
// Create a new slice to hold pointers to each FRUIT
|
|
var tmp []*Network
|
|
tmp = make([]*Network, len(x.Networks))
|
|
for i, p := range x.Networks {
|
|
tmp[i] = p // Copy pointers for safe iteration
|
|
}
|
|
|
|
return tmp
|
|
}
|
|
|
|
// safely returns a slice of pointers to the FRUIT protobufs
|
|
func (x *Droplet) allDisks() []*Disk {
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
// Create a new slice to hold pointers to each FRUIT
|
|
var tmp []*Disk
|
|
tmp = make([]*Disk, len(x.Disks))
|
|
for i, p := range x.Disks {
|
|
tmp[i] = p // Copy pointers for safe iteration
|
|
}
|
|
|
|
return tmp
|
|
}
|
|
|
|
// safely returns a slice of pointers to the Droplet protobufs
|
|
func (x *Droplets) selectAllDroplets() []*Droplet {
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
// Create a new slice to hold pointers to each Droplet
|
|
var tmp []*Droplet
|
|
tmp = make([]*Droplet, len(x.Droplets))
|
|
for i, p := range x.Droplets {
|
|
tmp[i] = p // Copy pointers for safe iteration
|
|
}
|
|
|
|
return tmp
|
|
}
|
|
|
|
// safely returns a slice of pointers to the Network protobufs
|
|
func (x *Droplet) selectAllNetworks() []*Network {
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
// Create a new slice to hold pointers to each Network
|
|
var tmp []*Network
|
|
tmp = make([]*Network, len(x.Networks))
|
|
for i, p := range x.Networks {
|
|
tmp[i] = p // Copy pointers for safe iteration
|
|
}
|
|
|
|
return tmp
|
|
}
|
|
|
|
// safely returns a slice of pointers to the Disk protobufs
|
|
func (x *Droplet) selectAllDisks() []*Disk {
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
// Create a new slice to hold pointers to each Disk
|
|
var tmp []*Disk
|
|
tmp = make([]*Disk, len(x.Disks))
|
|
for i, p := range x.Disks {
|
|
tmp[i] = p // Copy pointers for safe iteration
|
|
}
|
|
|
|
return tmp
|
|
}
|
|
|
|
// END SORT
|
|
|
|
func (x *Droplets) Len() int {
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
return len(x.Droplets)
|
|
}
|
|
|
|
// just a simple Append() shortcut (but still uses the mutex lock)
|
|
func (x *Droplets) Append(y *Droplet) {
|
|
x.Lock()
|
|
defer x.Unlock()
|
|
|
|
x.Droplets = append(x.Droplets, y)
|
|
}
|
|
|
|
func (x *Droplets) All() *DropletIterator {
|
|
DropletPointers := x.selectAllDroplets()
|
|
|
|
iterator := newDropletIterator(DropletPointers)
|
|
return iterator
|
|
}
|
|
|
|
func (x *Droplets) Delete(y *Droplet) bool {
|
|
x.Lock()
|
|
defer x.Unlock()
|
|
|
|
for i, _ := range x.Droplets {
|
|
if x.Droplets[i] == y {
|
|
x.Droplets[i] = x.Droplets[len(x.Droplets)-1]
|
|
x.Droplets = x.Droplets[:len(x.Droplets)-1]
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// lookup a Droplets by the Uuid
|
|
func (x *Droplets) FindByUuid(s string) *Droplet {
|
|
if x == nil {
|
|
return nil
|
|
}
|
|
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
for i, _ := range x.Droplets {
|
|
if x.Droplets[i].Uuid == s {
|
|
return x.Droplets[i]
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// lookup a Droplets by the Hostname
|
|
func (x *Droplets) FindByHostname(s string) *Droplet {
|
|
if x == nil {
|
|
return nil
|
|
}
|
|
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
for i, _ := range x.Droplets {
|
|
if x.Droplets[i].Hostname == s {
|
|
return x.Droplets[i]
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *Droplets) DeleteByUuid(s string) bool {
|
|
x.Lock()
|
|
defer x.Unlock()
|
|
|
|
for i, _ := range x.Droplets {
|
|
if x.Droplets[i].Uuid == s {
|
|
x.Droplets[i] = x.Droplets[len(x.Droplets)-1]
|
|
x.Droplets = x.Droplets[:len(x.Droplets)-1]
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (x *Droplets) DeleteByHostname(s string) bool {
|
|
x.Lock()
|
|
defer x.Unlock()
|
|
|
|
for i, _ := range x.Droplets {
|
|
if x.Droplets[i].Hostname == s {
|
|
x.Droplets[i] = x.Droplets[len(x.Droplets)-1]
|
|
x.Droplets = x.Droplets[:len(x.Droplets)-1]
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (x *Droplets) AppendByUuid(y *Droplet) bool {
|
|
x.Lock()
|
|
defer x.Unlock()
|
|
|
|
for _, p := range x.Droplets {
|
|
if p.Uuid == y.Uuid {
|
|
return false
|
|
}
|
|
}
|
|
|
|
x.Droplets = append(x.Droplets, y)
|
|
return true
|
|
}
|
|
|
|
func (x *Droplets) AppendByHostname(y *Droplet) bool {
|
|
x.Lock()
|
|
defer x.Unlock()
|
|
|
|
for _, p := range x.Droplets {
|
|
if p.Hostname == y.Hostname {
|
|
return false
|
|
}
|
|
}
|
|
|
|
x.Droplets = append(x.Droplets, y)
|
|
return true
|
|
}
|
|
|
|
// `autogen:event.marshal.pb.go`
|
|
|
|
// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT.
|
|
// This file was autogenerated with autogenpb v0.0.50 2025-02-07_10:22:09_UTC
|
|
// go install go.wit.com/apps/autogenpb@latest
|
|
//
|
|
// define which structs (messages) you want to use in the .proto file
|
|
// Then sort.pb.go and marshal.pb.go files are autogenerated
|
|
//
|
|
// autogenpb uses it and has an example .proto file with instructions
|
|
//
|
|
|
|
package virtbuf
|
|
|
|
import (
|
|
"google.golang.org/protobuf/encoding/protojson"
|
|
"google.golang.org/protobuf/encoding/prototext"
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
// human readable JSON
|
|
func (v *Events) FormatJSON() string {
|
|
return protojson.Format(v)
|
|
}
|
|
|
|
// marshal json
|
|
func (v *Events) MarshalJSON() ([]byte, error) {
|
|
return protojson.Marshal(v)
|
|
}
|
|
|
|
// unmarshal json
|
|
func (v *Events) UnmarshalJSON(data []byte) error {
|
|
return protojson.Unmarshal(data, v)
|
|
}
|
|
|
|
// apparently this isn't stable, but it's awesomely better
|
|
// https://protobuf.dev/reference/go/faq/#unstable-text
|
|
// it's brilliant for config files!
|
|
func (v *Events) FormatTEXT() string {
|
|
v.fixUuid()
|
|
return prototext.Format(v)
|
|
}
|
|
|
|
// unmarshalTEXT. This reads the .text config file back in after the user edits it
|
|
func (v *Events) UnmarshalTEXT(data []byte) error {
|
|
return prototext.Unmarshal(data, v)
|
|
}
|
|
|
|
// marshal to wire. This is called winning.
|
|
func (v *Events) Marshal() ([]byte, error) {
|
|
v.fixUuid()
|
|
return proto.Marshal(v)
|
|
}
|
|
|
|
// unmarshal from wire. You have won.
|
|
func (v *Events) Unmarshal(data []byte) error {
|
|
return proto.Unmarshal(data, v)
|
|
}
|
|
|
|
// `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
|
|
}
|
|
|
|
// `autogen:event.sort.pb.go`
|
|
|
|
// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT.
|
|
// This file was autogenerated with autogenpb v0.0.50 2025-02-07_10:22:09_UTC
|
|
// go install go.wit.com/apps/autogenpb@latest
|
|
//
|
|
// define which structs (messages) you want to use in the .proto file
|
|
// Then sort.pb.go and marshal.pb.go files are autogenerated
|
|
//
|
|
// autogenpb uses it and has an example .proto file with instructions
|
|
//
|
|
|
|
package virtbuf
|
|
|
|
import (
|
|
"fmt"
|
|
"sync"
|
|
)
|
|
|
|
// a simple global lock
|
|
var eventMu sync.RWMutex
|
|
|
|
func (x *Events) fixUuid() {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Uuid == "1e3a50c7-5916-4423-b33c-f0b977a7e446" {
|
|
return
|
|
}
|
|
x.Uuid = "1e3a50c7-5916-4423-b33c-f0b977a7e446"
|
|
x.Version = "v0.0.1 go.wit.com/lib/protobuf/virtbuf"
|
|
}
|
|
|
|
func NewEvents() *Events {
|
|
x := new(Events)
|
|
x.Uuid = "1e3a50c7-5916-4423-b33c-f0b977a7e446"
|
|
x.Version = "v0.0.1 go.wit.com/lib/protobuf/virtbuf"
|
|
return x
|
|
}
|
|
|
|
// START SORT
|
|
|
|
// DEFINE THE Events ITERATOR.
|
|
// itializes a new iterator.
|
|
func newEventsIterator(things []*Events) *EventsIterator {
|
|
return &EventsIterator{things: things}
|
|
}
|
|
|
|
type EventsIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*Events
|
|
index int
|
|
}
|
|
|
|
func (it *EventsIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *EventsIterator) Next() *Events {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in EventsIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// DEFINE THE Event ITERATOR.
|
|
// itializes a new iterator.
|
|
func newEventIterator(things []*Event) *EventIterator {
|
|
return &EventIterator{things: things}
|
|
}
|
|
|
|
type EventIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*Event
|
|
index int
|
|
}
|
|
|
|
func (it *EventIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *EventIterator) Next() *Event {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in EventIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// safely returns a slice of pointers to the FRUIT protobufs
|
|
func (x *Events) allEvents() []*Event {
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
// Create a new slice to hold pointers to each FRUIT
|
|
var tmp []*Event
|
|
tmp = make([]*Event, len(x.Events))
|
|
for i, p := range x.Events {
|
|
tmp[i] = p // Copy pointers for safe iteration
|
|
}
|
|
|
|
return tmp
|
|
}
|
|
|
|
// safely returns a slice of pointers to the Event protobufs
|
|
func (x *Events) selectAllEvents() []*Event {
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
// Create a new slice to hold pointers to each Event
|
|
var tmp []*Event
|
|
tmp = make([]*Event, len(x.Events))
|
|
for i, p := range x.Events {
|
|
tmp[i] = p // Copy pointers for safe iteration
|
|
}
|
|
|
|
return tmp
|
|
}
|
|
|
|
// END SORT
|
|
|
|
func (x *Events) Len() int {
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
return len(x.Events)
|
|
}
|
|
|
|
// just a simple Append() shortcut (but still uses the mutex lock)
|
|
func (x *Events) Append(y *Event) {
|
|
x.Lock()
|
|
defer x.Unlock()
|
|
|
|
x.Events = append(x.Events, y)
|
|
}
|
|
|
|
func (x *Events) All() *EventIterator {
|
|
EventPointers := x.selectAllEvents()
|
|
|
|
iterator := newEventIterator(EventPointers)
|
|
return iterator
|
|
}
|
|
|
|
func (x *Events) Delete(y *Event) bool {
|
|
x.Lock()
|
|
defer x.Unlock()
|
|
|
|
for i, _ := range x.Events {
|
|
if x.Events[i] == y {
|
|
x.Events[i] = x.Events[len(x.Events)-1]
|
|
x.Events = x.Events[:len(x.Events)-1]
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// `autogen:experiment.marshal.pb.go`
|
|
|
|
// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT.
|
|
// This file was autogenerated with autogenpb v0.0.50 2025-02-07_10:22:09_UTC
|
|
// go install go.wit.com/apps/autogenpb@latest
|
|
//
|
|
// define which structs (messages) you want to use in the .proto file
|
|
// Then sort.pb.go and marshal.pb.go files are autogenerated
|
|
//
|
|
// autogenpb uses it and has an example .proto file with instructions
|
|
//
|
|
|
|
package virtbuf
|
|
|
|
import (
|
|
"google.golang.org/protobuf/encoding/protojson"
|
|
"google.golang.org/protobuf/encoding/prototext"
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
// human readable JSON
|
|
func (v *Experiments) FormatJSON() string {
|
|
return protojson.Format(v)
|
|
}
|
|
|
|
// marshal json
|
|
func (v *Experiments) MarshalJSON() ([]byte, error) {
|
|
return protojson.Marshal(v)
|
|
}
|
|
|
|
// unmarshal json
|
|
func (v *Experiments) UnmarshalJSON(data []byte) error {
|
|
return protojson.Unmarshal(data, v)
|
|
}
|
|
|
|
// apparently this isn't stable, but it's awesomely better
|
|
// https://protobuf.dev/reference/go/faq/#unstable-text
|
|
// it's brilliant for config files!
|
|
func (v *Experiments) FormatTEXT() string {
|
|
v.fixUuid()
|
|
return prototext.Format(v)
|
|
}
|
|
|
|
// unmarshalTEXT. This reads the .text config file back in after the user edits it
|
|
func (v *Experiments) UnmarshalTEXT(data []byte) error {
|
|
return prototext.Unmarshal(data, v)
|
|
}
|
|
|
|
// marshal to wire. This is called winning.
|
|
func (v *Experiments) Marshal() ([]byte, error) {
|
|
v.fixUuid()
|
|
return proto.Marshal(v)
|
|
}
|
|
|
|
// unmarshal from wire. You have won.
|
|
func (v *Experiments) Unmarshal(data []byte) error {
|
|
return proto.Unmarshal(data, v)
|
|
}
|
|
|
|
// `autogen:experiment.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: experiment.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 WhatsThis struct {
|
|
sync.RWMutex // auto-added by go.wit.com/apps/autogenpb
|
|
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
// is it possible to have custom formatting in JSON and TEXT marshal/unmarshal ?
|
|
Humantest *WhatInfo `protobuf:"bytes,1,opt,name=humantest,proto3" json:"humantest,omitempty"`
|
|
End *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=end,proto3" json:"end,omitempty"` // end time
|
|
OrigVal *anypb.Any `protobuf:"bytes,3,opt,name=orig_val,json=origVal,proto3" json:"orig_val,omitempty"` // original value
|
|
NewVal *anypb.Any `protobuf:"bytes,4,opt,name=new_val,json=newVal,proto3" json:"new_val,omitempty"` // new value
|
|
}
|
|
|
|
func (x *WhatsThis) Reset() {
|
|
*x = WhatsThis{}
|
|
mi := &file_experiment_proto_msgTypes[0]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *WhatsThis) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*WhatsThis) ProtoMessage() {}
|
|
|
|
func (x *WhatsThis) ProtoReflect() protoreflect.Message {
|
|
mi := &file_experiment_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 WhatsThis.ProtoReflect.Descriptor instead.
|
|
func (*WhatsThis) Descriptor() ([]byte, []int) {
|
|
return file_experiment_proto_rawDescGZIP(), []int{0}
|
|
}
|
|
|
|
func (x *WhatsThis) GetHumantest() *WhatInfo {
|
|
if x != nil {
|
|
return x.Humantest
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *WhatsThis) GetEnd() *timestamppb.Timestamp {
|
|
if x != nil {
|
|
return x.End
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *WhatsThis) GetOrigVal() *anypb.Any {
|
|
if x != nil {
|
|
return x.OrigVal
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *WhatsThis) GetNewVal() *anypb.Any {
|
|
if x != nil {
|
|
return x.NewVal
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// this is for exerimenting
|
|
type WhatInfo struct {
|
|
sync.RWMutex // auto-added by go.wit.com/apps/autogenpb
|
|
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
|
|
Capacity int64 `protobuf:"varint,1,opt,name=capacity,proto3" json:"capacity,omitempty"` // Stores the storage capacity in bytes.
|
|
}
|
|
|
|
func (x *WhatInfo) Reset() {
|
|
*x = WhatInfo{}
|
|
mi := &file_experiment_proto_msgTypes[1]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *WhatInfo) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*WhatInfo) ProtoMessage() {}
|
|
|
|
func (x *WhatInfo) ProtoReflect() protoreflect.Message {
|
|
mi := &file_experiment_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 WhatInfo.ProtoReflect.Descriptor instead.
|
|
func (*WhatInfo) Descriptor() ([]byte, []int) {
|
|
return file_experiment_proto_rawDescGZIP(), []int{1}
|
|
}
|
|
|
|
func (x *WhatInfo) GetCapacity() int64 {
|
|
if x != nil {
|
|
return x.Capacity
|
|
}
|
|
return 0
|
|
}
|
|
|
|
type Experiment struct {
|
|
sync.RWMutex // auto-added by go.wit.com/apps/autogenpb
|
|
|
|
state protoimpl.MessageState
|
|
sizeCache protoimpl.SizeCache
|
|
unknownFields protoimpl.UnknownFields
|
|
}
|
|
|
|
func (x *Experiment) Reset() {
|
|
*x = Experiment{}
|
|
mi := &file_experiment_proto_msgTypes[2]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *Experiment) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*Experiment) ProtoMessage() {}
|
|
|
|
func (x *Experiment) ProtoReflect() protoreflect.Message {
|
|
mi := &file_experiment_proto_msgTypes[2]
|
|
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 Experiment.ProtoReflect.Descriptor instead.
|
|
func (*Experiment) Descriptor() ([]byte, []int) {
|
|
return file_experiment_proto_rawDescGZIP(), []int{2}
|
|
}
|
|
|
|
type Experiments 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:aadb95db-d798-4647-8c59-cce82e8f1ed6`
|
|
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // `autogenpb:version:v0.0.1`
|
|
Experiments []*Experiment `protobuf:"bytes,3,rep,name=Experiments,proto3" json:"Experiments,omitempty"` // THIS MUST BE Experiment and then Experiments
|
|
}
|
|
|
|
func (x *Experiments) Reset() {
|
|
*x = Experiments{}
|
|
mi := &file_experiment_proto_msgTypes[3]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *Experiments) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*Experiments) ProtoMessage() {}
|
|
|
|
func (x *Experiments) ProtoReflect() protoreflect.Message {
|
|
mi := &file_experiment_proto_msgTypes[3]
|
|
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 Experiments.ProtoReflect.Descriptor instead.
|
|
func (*Experiments) Descriptor() ([]byte, []int) {
|
|
return file_experiment_proto_rawDescGZIP(), []int{3}
|
|
}
|
|
|
|
func (x *Experiments) GetUuid() string {
|
|
if x != nil {
|
|
return x.Uuid
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Experiments) GetVersion() string {
|
|
if x != nil {
|
|
return x.Version
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Experiments) GetExperiments() []*Experiment {
|
|
if x != nil {
|
|
return x.Experiments
|
|
}
|
|
return nil
|
|
}
|
|
|
|
var File_experiment_proto protoreflect.FileDescriptor
|
|
|
|
var file_experiment_proto_rawDesc = []byte{
|
|
0x0a, 0x10, 0x65, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 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, 0xca, 0x01, 0x0a, 0x09, 0x57, 0x68, 0x61, 0x74,
|
|
0x73, 0x54, 0x68, 0x69, 0x73, 0x12, 0x2f, 0x0a, 0x09, 0x68, 0x75, 0x6d, 0x61, 0x6e, 0x74, 0x65,
|
|
0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x76, 0x69, 0x72, 0x74, 0x62,
|
|
0x75, 0x66, 0x2e, 0x57, 0x68, 0x61, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x09, 0x68, 0x75, 0x6d,
|
|
0x61, 0x6e, 0x74, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x18, 0x02, 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, 0x2f, 0x0a, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x5f, 0x76, 0x61, 0x6c,
|
|
0x18, 0x03, 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, 0x56, 0x61, 0x6c, 0x12, 0x2d, 0x0a, 0x07, 0x6e, 0x65, 0x77, 0x5f, 0x76, 0x61, 0x6c,
|
|
0x18, 0x04, 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, 0x56, 0x61, 0x6c, 0x22, 0x26, 0x0a, 0x08, 0x57, 0x68, 0x61, 0x74, 0x49, 0x6e, 0x66, 0x6f,
|
|
0x12, 0x1a, 0x0a, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01,
|
|
0x28, 0x03, 0x52, 0x08, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x22, 0x0c, 0x0a, 0x0a,
|
|
0x45, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x22, 0x72, 0x0a, 0x0b, 0x45, 0x78,
|
|
0x70, 0x65, 0x72, 0x69, 0x6d, 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, 0x35, 0x0a, 0x0b, 0x45, 0x78, 0x70, 0x65, 0x72,
|
|
0x69, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x76,
|
|
0x69, 0x72, 0x74, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e,
|
|
0x74, 0x52, 0x0b, 0x45, 0x78, 0x70, 0x65, 0x72, 0x69, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x62, 0x06,
|
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
}
|
|
|
|
var (
|
|
file_experiment_proto_rawDescOnce sync.Once
|
|
file_experiment_proto_rawDescData = file_experiment_proto_rawDesc
|
|
)
|
|
|
|
func file_experiment_proto_rawDescGZIP() []byte {
|
|
file_experiment_proto_rawDescOnce.Do(func() {
|
|
file_experiment_proto_rawDescData = protoimpl.X.CompressGZIP(file_experiment_proto_rawDescData)
|
|
})
|
|
return file_experiment_proto_rawDescData
|
|
}
|
|
|
|
var file_experiment_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
|
var file_experiment_proto_goTypes = []any{
|
|
(*WhatsThis)(nil), // 0: virtbuf.WhatsThis
|
|
(*WhatInfo)(nil), // 1: virtbuf.WhatInfo
|
|
(*Experiment)(nil), // 2: virtbuf.Experiment
|
|
(*Experiments)(nil), // 3: virtbuf.Experiments
|
|
(*timestamppb.Timestamp)(nil), // 4: google.protobuf.Timestamp
|
|
(*anypb.Any)(nil), // 5: google.protobuf.Any
|
|
}
|
|
var file_experiment_proto_depIdxs = []int32{
|
|
1, // 0: virtbuf.WhatsThis.humantest:type_name -> virtbuf.WhatInfo
|
|
4, // 1: virtbuf.WhatsThis.end:type_name -> google.protobuf.Timestamp
|
|
5, // 2: virtbuf.WhatsThis.orig_val:type_name -> google.protobuf.Any
|
|
5, // 3: virtbuf.WhatsThis.new_val:type_name -> google.protobuf.Any
|
|
2, // 4: virtbuf.Experiments.Experiments:type_name -> virtbuf.Experiment
|
|
5, // [5:5] is the sub-list for method output_type
|
|
5, // [5:5] is the sub-list for method input_type
|
|
5, // [5:5] is the sub-list for extension type_name
|
|
5, // [5:5] is the sub-list for extension extendee
|
|
0, // [0:5] is the sub-list for field type_name
|
|
}
|
|
|
|
func init() { file_experiment_proto_init() }
|
|
func file_experiment_proto_init() {
|
|
if File_experiment_proto != nil {
|
|
return
|
|
}
|
|
type x struct{}
|
|
out := protoimpl.TypeBuilder{
|
|
File: protoimpl.DescBuilder{
|
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
|
RawDescriptor: file_experiment_proto_rawDesc,
|
|
NumEnums: 0,
|
|
NumMessages: 4,
|
|
NumExtensions: 0,
|
|
NumServices: 0,
|
|
},
|
|
GoTypes: file_experiment_proto_goTypes,
|
|
DependencyIndexes: file_experiment_proto_depIdxs,
|
|
MessageInfos: file_experiment_proto_msgTypes,
|
|
}.Build()
|
|
File_experiment_proto = out.File
|
|
file_experiment_proto_rawDesc = nil
|
|
file_experiment_proto_goTypes = nil
|
|
file_experiment_proto_depIdxs = nil
|
|
}
|
|
|
|
// `autogen:experiment.sort.pb.go`
|
|
|
|
// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT.
|
|
// This file was autogenerated with autogenpb v0.0.50 2025-02-07_10:22:09_UTC
|
|
// go install go.wit.com/apps/autogenpb@latest
|
|
//
|
|
// define which structs (messages) you want to use in the .proto file
|
|
// Then sort.pb.go and marshal.pb.go files are autogenerated
|
|
//
|
|
// autogenpb uses it and has an example .proto file with instructions
|
|
//
|
|
|
|
package virtbuf
|
|
|
|
import (
|
|
"fmt"
|
|
"sync"
|
|
)
|
|
|
|
// a simple global lock
|
|
var experimentMu sync.RWMutex
|
|
|
|
func (x *Experiments) fixUuid() {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Uuid == "aadb95db-d798-4647-8c59-cce82e8f1ed6" {
|
|
return
|
|
}
|
|
x.Uuid = "aadb95db-d798-4647-8c59-cce82e8f1ed6"
|
|
x.Version = "v0.0.1 go.wit.com/lib/protobuf/virtbuf"
|
|
}
|
|
|
|
func NewExperiments() *Experiments {
|
|
x := new(Experiments)
|
|
x.Uuid = "aadb95db-d798-4647-8c59-cce82e8f1ed6"
|
|
x.Version = "v0.0.1 go.wit.com/lib/protobuf/virtbuf"
|
|
return x
|
|
}
|
|
|
|
// START SORT
|
|
|
|
// DEFINE THE Experiments ITERATOR.
|
|
// itializes a new iterator.
|
|
func newExperimentsIterator(things []*Experiments) *ExperimentsIterator {
|
|
return &ExperimentsIterator{things: things}
|
|
}
|
|
|
|
type ExperimentsIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*Experiments
|
|
index int
|
|
}
|
|
|
|
func (it *ExperimentsIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *ExperimentsIterator) Next() *Experiments {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in ExperimentsIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// DEFINE THE Experiment ITERATOR.
|
|
// itializes a new iterator.
|
|
func newExperimentIterator(things []*Experiment) *ExperimentIterator {
|
|
return &ExperimentIterator{things: things}
|
|
}
|
|
|
|
type ExperimentIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*Experiment
|
|
index int
|
|
}
|
|
|
|
func (it *ExperimentIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *ExperimentIterator) Next() *Experiment {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in ExperimentIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// DEFINE THE WhatsThis ITERATOR.
|
|
// itializes a new iterator.
|
|
func newWhatsThisIterator(things []*WhatsThis) *WhatsThisIterator {
|
|
return &WhatsThisIterator{things: things}
|
|
}
|
|
|
|
type WhatsThisIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*WhatsThis
|
|
index int
|
|
}
|
|
|
|
func (it *WhatsThisIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *WhatsThisIterator) Next() *WhatsThis {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in WhatsThisIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// DEFINE THE WhatInfo ITERATOR.
|
|
// itializes a new iterator.
|
|
func newWhatInfoIterator(things []*WhatInfo) *WhatInfoIterator {
|
|
return &WhatInfoIterator{things: things}
|
|
}
|
|
|
|
type WhatInfoIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*WhatInfo
|
|
index int
|
|
}
|
|
|
|
func (it *WhatInfoIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *WhatInfoIterator) Next() *WhatInfo {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in WhatInfoIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// safely returns a slice of pointers to the FRUIT protobufs
|
|
func (x *Experiments) allExperiments() []*Experiment {
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
// Create a new slice to hold pointers to each FRUIT
|
|
var tmp []*Experiment
|
|
tmp = make([]*Experiment, len(x.Experiments))
|
|
for i, p := range x.Experiments {
|
|
tmp[i] = p // Copy pointers for safe iteration
|
|
}
|
|
|
|
return tmp
|
|
}
|
|
|
|
// safely returns a slice of pointers to the Experiment protobufs
|
|
func (x *Experiments) selectAllExperiments() []*Experiment {
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
// Create a new slice to hold pointers to each Experiment
|
|
var tmp []*Experiment
|
|
tmp = make([]*Experiment, len(x.Experiments))
|
|
for i, p := range x.Experiments {
|
|
tmp[i] = p // Copy pointers for safe iteration
|
|
}
|
|
|
|
return tmp
|
|
}
|
|
|
|
// END SORT
|
|
|
|
func (x *Experiments) Len() int {
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
return len(x.Experiments)
|
|
}
|
|
|
|
// just a simple Append() shortcut (but still uses the mutex lock)
|
|
func (x *Experiments) Append(y *Experiment) {
|
|
x.Lock()
|
|
defer x.Unlock()
|
|
|
|
x.Experiments = append(x.Experiments, y)
|
|
}
|
|
|
|
func (x *Experiments) All() *ExperimentIterator {
|
|
ExperimentPointers := x.selectAllExperiments()
|
|
|
|
iterator := newExperimentIterator(ExperimentPointers)
|
|
return iterator
|
|
}
|
|
|
|
func (x *Experiments) Delete(y *Experiment) bool {
|
|
x.Lock()
|
|
defer x.Unlock()
|
|
|
|
for i, _ := range x.Experiments {
|
|
if x.Experiments[i] == y {
|
|
x.Experiments[i] = x.Experiments[len(x.Experiments)-1]
|
|
x.Experiments = x.Experiments[:len(x.Experiments)-1]
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// `autogen:hypervisor.marshal.pb.go`
|
|
|
|
// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT.
|
|
// This file was autogenerated with autogenpb v0.0.50 2025-02-07_10:22:09_UTC
|
|
// go install go.wit.com/apps/autogenpb@latest
|
|
//
|
|
// define which structs (messages) you want to use in the .proto file
|
|
// Then sort.pb.go and marshal.pb.go files are autogenerated
|
|
//
|
|
// autogenpb uses it and has an example .proto file with instructions
|
|
//
|
|
|
|
package virtbuf
|
|
|
|
import (
|
|
"google.golang.org/protobuf/encoding/protojson"
|
|
"google.golang.org/protobuf/encoding/prototext"
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
// human readable JSON
|
|
func (v *Hypervisors) FormatJSON() string {
|
|
return protojson.Format(v)
|
|
}
|
|
|
|
// marshal json
|
|
func (v *Hypervisors) MarshalJSON() ([]byte, error) {
|
|
return protojson.Marshal(v)
|
|
}
|
|
|
|
// unmarshal json
|
|
func (v *Hypervisors) UnmarshalJSON(data []byte) error {
|
|
return protojson.Unmarshal(data, v)
|
|
}
|
|
|
|
// apparently this isn't stable, but it's awesomely better
|
|
// https://protobuf.dev/reference/go/faq/#unstable-text
|
|
// it's brilliant for config files!
|
|
func (v *Hypervisors) FormatTEXT() string {
|
|
v.fixUuid()
|
|
return prototext.Format(v)
|
|
}
|
|
|
|
// unmarshalTEXT. This reads the .text config file back in after the user edits it
|
|
func (v *Hypervisors) UnmarshalTEXT(data []byte) error {
|
|
return prototext.Unmarshal(data, v)
|
|
}
|
|
|
|
// marshal to wire. This is called winning.
|
|
func (v *Hypervisors) Marshal() ([]byte, error) {
|
|
v.fixUuid()
|
|
return proto.Marshal(v)
|
|
}
|
|
|
|
// unmarshal from wire. You have won.
|
|
func (v *Hypervisors) Unmarshal(data []byte) error {
|
|
return proto.Unmarshal(data, v)
|
|
}
|
|
|
|
// `autogen:hypervisor.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: hypervisor.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"
|
|
)
|
|
|
|
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)
|
|
)
|
|
|
|
// think about this more
|
|
type HypervisorArch int32
|
|
|
|
const (
|
|
HypervisorArch_RISCV64 HypervisorArch = 0
|
|
HypervisorArch_X86_64 HypervisorArch = 1
|
|
HypervisorArch_ARM64 HypervisorArch = 2
|
|
)
|
|
|
|
// Enum value maps for HypervisorArch.
|
|
var (
|
|
HypervisorArch_name = map[int32]string{
|
|
0: "RISCV64",
|
|
1: "X86_64",
|
|
2: "ARM64",
|
|
}
|
|
HypervisorArch_value = map[string]int32{
|
|
"RISCV64": 0,
|
|
"X86_64": 1,
|
|
"ARM64": 2,
|
|
}
|
|
)
|
|
|
|
func (x HypervisorArch) Enum() *HypervisorArch {
|
|
p := new(HypervisorArch)
|
|
*p = x
|
|
return p
|
|
}
|
|
|
|
func (x HypervisorArch) String() string {
|
|
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
|
}
|
|
|
|
func (HypervisorArch) Descriptor() protoreflect.EnumDescriptor {
|
|
return file_hypervisor_proto_enumTypes[0].Descriptor()
|
|
}
|
|
|
|
func (HypervisorArch) Type() protoreflect.EnumType {
|
|
return &file_hypervisor_proto_enumTypes[0]
|
|
}
|
|
|
|
func (x HypervisorArch) Number() protoreflect.EnumNumber {
|
|
return protoreflect.EnumNumber(x)
|
|
}
|
|
|
|
// Deprecated: Use HypervisorArch.Descriptor instead.
|
|
func (HypervisorArch) EnumDescriptor() ([]byte, []int) {
|
|
return file_hypervisor_proto_rawDescGZIP(), []int{0}
|
|
}
|
|
|
|
type Hypervisors 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:6e3aa8b9-cf98-40f6-af58-3c6ad1edf4d4`
|
|
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // `autogenpb:version:v0.0.1`
|
|
Hypervisors []*Hypervisor `protobuf:"bytes,3,rep,name=hypervisors,proto3" json:"hypervisors,omitempty"`
|
|
}
|
|
|
|
func (x *Hypervisors) Reset() {
|
|
*x = Hypervisors{}
|
|
mi := &file_hypervisor_proto_msgTypes[0]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *Hypervisors) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*Hypervisors) ProtoMessage() {}
|
|
|
|
func (x *Hypervisors) ProtoReflect() protoreflect.Message {
|
|
mi := &file_hypervisor_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 Hypervisors.ProtoReflect.Descriptor instead.
|
|
func (*Hypervisors) Descriptor() ([]byte, []int) {
|
|
return file_hypervisor_proto_rawDescGZIP(), []int{0}
|
|
}
|
|
|
|
func (x *Hypervisors) GetUuid() string {
|
|
if x != nil {
|
|
return x.Uuid
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Hypervisors) GetVersion() string {
|
|
if x != nil {
|
|
return x.Version
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Hypervisors) GetHypervisors() []*Hypervisor {
|
|
if x != nil {
|
|
return x.Hypervisors
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type Hypervisor 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:unique`
|
|
Hostname string `protobuf:"bytes,2,opt,name=hostname,proto3" json:"hostname,omitempty"` // `autogenpb:unique`
|
|
Active bool `protobuf:"varint,3,opt,name=active,proto3" json:"active,omitempty"` // is allowed to start new droplets
|
|
Cpus int64 `protobuf:"varint,4,opt,name=cpus,proto3" json:"cpus,omitempty"`
|
|
Memory int64 `protobuf:"varint,5,opt,name=memory,proto3" json:"memory,omitempty"` // in bytes
|
|
Comment string `protobuf:"bytes,6,opt,name=comment,proto3" json:"comment,omitempty"`
|
|
Autoscan bool `protobuf:"varint,7,opt,name=autoscan,proto3" json:"autoscan,omitempty"` // to scan or not to scan by virtigo
|
|
Arch HypervisorArch `protobuf:"varint,8,opt,name=arch,proto3,enum=virtbuf.HypervisorArch" json:"arch,omitempty"`
|
|
}
|
|
|
|
func (x *Hypervisor) Reset() {
|
|
*x = Hypervisor{}
|
|
mi := &file_hypervisor_proto_msgTypes[1]
|
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
|
ms.StoreMessageInfo(mi)
|
|
}
|
|
|
|
func (x *Hypervisor) String() string {
|
|
return protoimpl.X.MessageStringOf(x)
|
|
}
|
|
|
|
func (*Hypervisor) ProtoMessage() {}
|
|
|
|
func (x *Hypervisor) ProtoReflect() protoreflect.Message {
|
|
mi := &file_hypervisor_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 Hypervisor.ProtoReflect.Descriptor instead.
|
|
func (*Hypervisor) Descriptor() ([]byte, []int) {
|
|
return file_hypervisor_proto_rawDescGZIP(), []int{1}
|
|
}
|
|
|
|
func (x *Hypervisor) GetUuid() string {
|
|
if x != nil {
|
|
return x.Uuid
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Hypervisor) GetHostname() string {
|
|
if x != nil {
|
|
return x.Hostname
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Hypervisor) GetActive() bool {
|
|
if x != nil {
|
|
return x.Active
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (x *Hypervisor) GetCpus() int64 {
|
|
if x != nil {
|
|
return x.Cpus
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *Hypervisor) GetMemory() int64 {
|
|
if x != nil {
|
|
return x.Memory
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (x *Hypervisor) GetComment() string {
|
|
if x != nil {
|
|
return x.Comment
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (x *Hypervisor) GetAutoscan() bool {
|
|
if x != nil {
|
|
return x.Autoscan
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (x *Hypervisor) GetArch() HypervisorArch {
|
|
if x != nil {
|
|
return x.Arch
|
|
}
|
|
return HypervisorArch_RISCV64
|
|
}
|
|
|
|
var File_hypervisor_proto protoreflect.FileDescriptor
|
|
|
|
var file_hypervisor_proto_rawDesc = []byte{
|
|
0x0a, 0x10, 0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f,
|
|
0x74, 0x6f, 0x12, 0x07, 0x76, 0x69, 0x72, 0x74, 0x62, 0x75, 0x66, 0x22, 0x72, 0x0a, 0x0b, 0x48,
|
|
0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 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, 0x35, 0x0a, 0x0b, 0x68, 0x79, 0x70, 0x65,
|
|
0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e,
|
|
0x76, 0x69, 0x72, 0x74, 0x62, 0x75, 0x66, 0x2e, 0x48, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73,
|
|
0x6f, 0x72, 0x52, 0x0b, 0x68, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x73, 0x22,
|
|
0xe3, 0x01, 0x0a, 0x0a, 0x48, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x12, 0x12,
|
|
0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75,
|
|
0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02,
|
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16,
|
|
0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06,
|
|
0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x70, 0x75, 0x73, 0x18, 0x04,
|
|
0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x63, 0x70, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65,
|
|
0x6d, 0x6f, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6d, 0x65, 0x6d, 0x6f,
|
|
0x72, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20,
|
|
0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08,
|
|
0x61, 0x75, 0x74, 0x6f, 0x73, 0x63, 0x61, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08,
|
|
0x61, 0x75, 0x74, 0x6f, 0x73, 0x63, 0x61, 0x6e, 0x12, 0x2b, 0x0a, 0x04, 0x61, 0x72, 0x63, 0x68,
|
|
0x18, 0x08, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x76, 0x69, 0x72, 0x74, 0x62, 0x75, 0x66,
|
|
0x2e, 0x48, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69, 0x73, 0x6f, 0x72, 0x41, 0x72, 0x63, 0x68, 0x52,
|
|
0x04, 0x61, 0x72, 0x63, 0x68, 0x2a, 0x34, 0x0a, 0x0e, 0x48, 0x79, 0x70, 0x65, 0x72, 0x76, 0x69,
|
|
0x73, 0x6f, 0x72, 0x41, 0x72, 0x63, 0x68, 0x12, 0x0b, 0x0a, 0x07, 0x52, 0x49, 0x53, 0x43, 0x56,
|
|
0x36, 0x34, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x58, 0x38, 0x36, 0x5f, 0x36, 0x34, 0x10, 0x01,
|
|
0x12, 0x09, 0x0a, 0x05, 0x41, 0x52, 0x4d, 0x36, 0x34, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
|
0x74, 0x6f, 0x33,
|
|
}
|
|
|
|
var (
|
|
file_hypervisor_proto_rawDescOnce sync.Once
|
|
file_hypervisor_proto_rawDescData = file_hypervisor_proto_rawDesc
|
|
)
|
|
|
|
func file_hypervisor_proto_rawDescGZIP() []byte {
|
|
file_hypervisor_proto_rawDescOnce.Do(func() {
|
|
file_hypervisor_proto_rawDescData = protoimpl.X.CompressGZIP(file_hypervisor_proto_rawDescData)
|
|
})
|
|
return file_hypervisor_proto_rawDescData
|
|
}
|
|
|
|
var file_hypervisor_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
|
var file_hypervisor_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
|
var file_hypervisor_proto_goTypes = []any{
|
|
(HypervisorArch)(0), // 0: virtbuf.HypervisorArch
|
|
(*Hypervisors)(nil), // 1: virtbuf.Hypervisors
|
|
(*Hypervisor)(nil), // 2: virtbuf.Hypervisor
|
|
}
|
|
var file_hypervisor_proto_depIdxs = []int32{
|
|
2, // 0: virtbuf.Hypervisors.hypervisors:type_name -> virtbuf.Hypervisor
|
|
0, // 1: virtbuf.Hypervisor.arch:type_name -> virtbuf.HypervisorArch
|
|
2, // [2:2] is the sub-list for method output_type
|
|
2, // [2:2] is the sub-list for method input_type
|
|
2, // [2:2] is the sub-list for extension type_name
|
|
2, // [2:2] is the sub-list for extension extendee
|
|
0, // [0:2] is the sub-list for field type_name
|
|
}
|
|
|
|
func init() { file_hypervisor_proto_init() }
|
|
func file_hypervisor_proto_init() {
|
|
if File_hypervisor_proto != nil {
|
|
return
|
|
}
|
|
type x struct{}
|
|
out := protoimpl.TypeBuilder{
|
|
File: protoimpl.DescBuilder{
|
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
|
RawDescriptor: file_hypervisor_proto_rawDesc,
|
|
NumEnums: 1,
|
|
NumMessages: 2,
|
|
NumExtensions: 0,
|
|
NumServices: 0,
|
|
},
|
|
GoTypes: file_hypervisor_proto_goTypes,
|
|
DependencyIndexes: file_hypervisor_proto_depIdxs,
|
|
EnumInfos: file_hypervisor_proto_enumTypes,
|
|
MessageInfos: file_hypervisor_proto_msgTypes,
|
|
}.Build()
|
|
File_hypervisor_proto = out.File
|
|
file_hypervisor_proto_rawDesc = nil
|
|
file_hypervisor_proto_goTypes = nil
|
|
file_hypervisor_proto_depIdxs = nil
|
|
}
|
|
|
|
// `autogen:hypervisor.sort.pb.go`
|
|
|
|
// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT.
|
|
// This file was autogenerated with autogenpb v0.0.50 2025-02-07_10:22:09_UTC
|
|
// go install go.wit.com/apps/autogenpb@latest
|
|
//
|
|
// define which structs (messages) you want to use in the .proto file
|
|
// Then sort.pb.go and marshal.pb.go files are autogenerated
|
|
//
|
|
// autogenpb uses it and has an example .proto file with instructions
|
|
//
|
|
|
|
package virtbuf
|
|
|
|
import (
|
|
"fmt"
|
|
"sync"
|
|
)
|
|
|
|
// a simple global lock
|
|
var hypervisorMu sync.RWMutex
|
|
|
|
func (x *Hypervisors) fixUuid() {
|
|
if x == nil {
|
|
return
|
|
}
|
|
if x.Uuid == "6e3aa8b9-cf98-40f6-af58-3c6ad1edf4d4" {
|
|
return
|
|
}
|
|
x.Uuid = "6e3aa8b9-cf98-40f6-af58-3c6ad1edf4d4"
|
|
x.Version = "v0.0.1 go.wit.com/lib/protobuf/virtbuf"
|
|
}
|
|
|
|
func NewHypervisors() *Hypervisors {
|
|
x := new(Hypervisors)
|
|
x.Uuid = "6e3aa8b9-cf98-40f6-af58-3c6ad1edf4d4"
|
|
x.Version = "v0.0.1 go.wit.com/lib/protobuf/virtbuf"
|
|
return x
|
|
}
|
|
|
|
// START SORT
|
|
|
|
// DEFINE THE Hypervisors ITERATOR.
|
|
// itializes a new iterator.
|
|
func newHypervisorsIterator(things []*Hypervisors) *HypervisorsIterator {
|
|
return &HypervisorsIterator{things: things}
|
|
}
|
|
|
|
type HypervisorsIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*Hypervisors
|
|
index int
|
|
}
|
|
|
|
func (it *HypervisorsIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *HypervisorsIterator) Next() *Hypervisors {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in HypervisorsIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// DEFINE THE Hypervisor ITERATOR.
|
|
// itializes a new iterator.
|
|
func newHypervisorIterator(things []*Hypervisor) *HypervisorIterator {
|
|
return &HypervisorIterator{things: things}
|
|
}
|
|
|
|
type HypervisorIterator struct {
|
|
sync.RWMutex // this isn't getting used properly yet?
|
|
|
|
things []*Hypervisor
|
|
index int
|
|
}
|
|
|
|
func (it *HypervisorIterator) Scan() bool {
|
|
if it.index >= len(it.things) {
|
|
return false
|
|
}
|
|
it.index++
|
|
return true
|
|
}
|
|
|
|
// Next() returns the next thing in the array
|
|
func (it *HypervisorIterator) Next() *Hypervisor {
|
|
if it.things[it.index-1] == nil {
|
|
fmt.Println("Next() error in HypervisorIterator", it.index)
|
|
}
|
|
return it.things[it.index-1]
|
|
}
|
|
|
|
// END DEFINE THE ITERATOR
|
|
|
|
// safely returns a slice of pointers to the FRUIT protobufs
|
|
func (x *Hypervisors) allHypervisors() []*Hypervisor {
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
// Create a new slice to hold pointers to each FRUIT
|
|
var tmp []*Hypervisor
|
|
tmp = make([]*Hypervisor, len(x.Hypervisors))
|
|
for i, p := range x.Hypervisors {
|
|
tmp[i] = p // Copy pointers for safe iteration
|
|
}
|
|
|
|
return tmp
|
|
}
|
|
|
|
// safely returns a slice of pointers to the Hypervisor protobufs
|
|
func (x *Hypervisors) selectAllHypervisors() []*Hypervisor {
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
// Create a new slice to hold pointers to each Hypervisor
|
|
var tmp []*Hypervisor
|
|
tmp = make([]*Hypervisor, len(x.Hypervisors))
|
|
for i, p := range x.Hypervisors {
|
|
tmp[i] = p // Copy pointers for safe iteration
|
|
}
|
|
|
|
return tmp
|
|
}
|
|
|
|
// END SORT
|
|
|
|
func (x *Hypervisors) Len() int {
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
return len(x.Hypervisors)
|
|
}
|
|
|
|
// just a simple Append() shortcut (but still uses the mutex lock)
|
|
func (x *Hypervisors) Append(y *Hypervisor) {
|
|
x.Lock()
|
|
defer x.Unlock()
|
|
|
|
x.Hypervisors = append(x.Hypervisors, y)
|
|
}
|
|
|
|
func (x *Hypervisors) All() *HypervisorIterator {
|
|
HypervisorPointers := x.selectAllHypervisors()
|
|
|
|
iterator := newHypervisorIterator(HypervisorPointers)
|
|
return iterator
|
|
}
|
|
|
|
func (x *Hypervisors) Delete(y *Hypervisor) bool {
|
|
x.Lock()
|
|
defer x.Unlock()
|
|
|
|
for i, _ := range x.Hypervisors {
|
|
if x.Hypervisors[i] == y {
|
|
x.Hypervisors[i] = x.Hypervisors[len(x.Hypervisors)-1]
|
|
x.Hypervisors = x.Hypervisors[:len(x.Hypervisors)-1]
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// lookup a Hypervisors by the Uuid
|
|
func (x *Hypervisors) FindByUuid(s string) *Hypervisor {
|
|
if x == nil {
|
|
return nil
|
|
}
|
|
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
for i, _ := range x.Hypervisors {
|
|
if x.Hypervisors[i].Uuid == s {
|
|
return x.Hypervisors[i]
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// lookup a Hypervisors by the Hostname
|
|
func (x *Hypervisors) FindByHostname(s string) *Hypervisor {
|
|
if x == nil {
|
|
return nil
|
|
}
|
|
|
|
x.RLock()
|
|
defer x.RUnlock()
|
|
|
|
for i, _ := range x.Hypervisors {
|
|
if x.Hypervisors[i].Hostname == s {
|
|
return x.Hypervisors[i]
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (x *Hypervisors) DeleteByUuid(s string) bool {
|
|
x.Lock()
|
|
defer x.Unlock()
|
|
|
|
for i, _ := range x.Hypervisors {
|
|
if x.Hypervisors[i].Uuid == s {
|
|
x.Hypervisors[i] = x.Hypervisors[len(x.Hypervisors)-1]
|
|
x.Hypervisors = x.Hypervisors[:len(x.Hypervisors)-1]
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (x *Hypervisors) DeleteByHostname(s string) bool {
|
|
x.Lock()
|
|
defer x.Unlock()
|
|
|
|
for i, _ := range x.Hypervisors {
|
|
if x.Hypervisors[i].Hostname == s {
|
|
x.Hypervisors[i] = x.Hypervisors[len(x.Hypervisors)-1]
|
|
x.Hypervisors = x.Hypervisors[:len(x.Hypervisors)-1]
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (x *Hypervisors) AppendByUuid(y *Hypervisor) bool {
|
|
x.Lock()
|
|
defer x.Unlock()
|
|
|
|
for _, p := range x.Hypervisors {
|
|
if p.Uuid == y.Uuid {
|
|
return false
|
|
}
|
|
}
|
|
|
|
x.Hypervisors = append(x.Hypervisors, y)
|
|
return true
|
|
}
|
|
|
|
func (x *Hypervisors) AppendByHostname(y *Hypervisor) bool {
|
|
x.Lock()
|
|
defer x.Unlock()
|
|
|
|
for _, p := range x.Hypervisors {
|
|
if p.Hostname == y.Hostname {
|
|
return false
|
|
}
|
|
}
|
|
|
|
x.Hypervisors = append(x.Hypervisors, y)
|
|
return true
|
|
}
|
|
|
|
// `autogen:`
|