diff --git a/buf.work.yaml b/buf.work.yaml index 275550ea..b72eb84b 100644 --- a/buf.work.yaml +++ b/buf.work.yaml @@ -2,6 +2,6 @@ version: v1 directories: - proto/node - proto/provider + - .cache/include - vendor/github.com/cosmos/cosmos-sdk/proto - vendor/github.com/cosmos/cosmos-sdk/third_party/proto - - vendor/k8s.io/apimachinery/pkg/api/resource diff --git a/go/inventory/v1/cluster.go b/go/inventory/v1/cluster.go new file mode 100644 index 00000000..f3634e31 --- /dev/null +++ b/go/inventory/v1/cluster.go @@ -0,0 +1,10 @@ +package v1 + +func (cl *Cluster) Dup() *Cluster { + res := &Cluster{ + Nodes: cl.Nodes.Dup(), + Storage: cl.Storage.Dup(), + } + + return res +} diff --git a/go/inventory/v1/cluster.pb.go b/go/inventory/v1/cluster.pb.go index ee4c22af..8b45c53d 100644 --- a/go/inventory/v1/cluster.pb.go +++ b/go/inventory/v1/cluster.pb.go @@ -23,6 +23,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// Cluster reports inventory across entire cluster type Cluster struct { Nodes Nodes `protobuf:"bytes,1,rep,name=nodes,proto3,castrepeated=Nodes" json:"nodes" yaml:"nodes"` Storage ClusterStorage `protobuf:"bytes,2,rep,name=storage,proto3,castrepeated=ClusterStorage" json:"storage" yaml:"storage"` @@ -82,27 +83,26 @@ func init() { func init() { proto.RegisterFile("akash/inventory/v1/cluster.proto", fileDescriptor_205585ebfe7f68ce) } var fileDescriptor_205585ebfe7f68ce = []byte{ - // 309 bytes of a gzipped FileDescriptorProto + // 292 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xcc, 0x4e, 0x2c, 0xce, 0xd0, 0xcf, 0xcc, 0x2b, 0x4b, 0xcd, 0x2b, 0xc9, 0x2f, 0xaa, 0xd4, 0x2f, 0x33, 0xd4, 0x4f, 0xce, 0x29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, 0x10, 0x79, 0xa1, 0x52, + 0x2e, 0x76, 0xa8, 0xed, 0x12, 0x4c, 0x60, 0x2b, 0xa4, 0xb1, 0x59, 0x11, 0x0c, 0x51, 0xe2, 0x64, + 0x07, 0xb5, 0x85, 0x1d, 0x2a, 0xf0, 0xea, 0x9e, 0x3c, 0x4c, 0xfb, 0xa7, 0x7b, 0xf2, 0x7c, 0x10, + 0x9b, 0xa0, 0x02, 0x20, 0xbb, 0xf8, 0xa0, 0xfe, 0x80, 0x2a, 0x0f, 0x82, 0x29, 0xb6, 0x62, 0x79, + 0xb1, 0x40, 0x9e, 0xc1, 0xc9, 0xe7, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, + 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, + 0x8c, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xc1, 0xee, 0xd1, 0xcd, + 0x4b, 0x2d, 0x29, 0xcf, 0x2f, 0xca, 0x86, 0xf2, 0x12, 0x0b, 0x32, 0xf5, 0xd3, 0xf3, 0x51, 0x42, + 0x31, 0x89, 0x0d, 0x1c, 0x7c, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x38, 0x3a, 0xd9, 0x8b, + 0xcd, 0x01, 0x00, 0x00, } func (m *Cluster) Marshal() (dAtA []byte, err error) { diff --git a/go/inventory/v1/cpu.go b/go/inventory/v1/cpu.go new file mode 100644 index 00000000..d3f22d38 --- /dev/null +++ b/go/inventory/v1/cpu.go @@ -0,0 +1,29 @@ +package v1 + +func (r *CPU) Dup() CPU { + res := CPU{ + Quantity: r.Quantity.Dup(), + Info: r.Info.Dup(), + } + + return res +} + +func (s CPUInfoS) Dup() CPUInfoS { + if len(s) == 0 { + return nil + } + + res := make(CPUInfoS, 0, len(s)) + + for _, n := range s { + res = append(res, CPUInfo{ + ID: n.ID, + Vendor: n.Vendor, + Model: n.Model, + Vcores: n.Vcores, + }) + } + + return res +} diff --git a/go/inventory/v1/cpu.pb.go b/go/inventory/v1/cpu.pb.go index 04ea62c0..22c9a5c3 100644 --- a/go/inventory/v1/cpu.pb.go +++ b/go/inventory/v1/cpu.pb.go @@ -6,7 +6,7 @@ package v1 import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" + proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" @@ -21,8 +21,9 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// CPUInfo reports CPU details type CPUInfo struct { ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" yaml:"id"` Vendor string `protobuf:"bytes,2,opt,name=vendor,proto3" json:"vendor" yaml:"vendor"` @@ -91,9 +92,10 @@ func (m *CPUInfo) GetVcores() uint32 { return 0 } +// CPU reports CPU inventory details type CPU struct { Quantity ResourcePair `protobuf:"bytes,1,opt,name=quantity,proto3" json:"quantity" yaml:"quantity"` - Info []CPUInfo `protobuf:"bytes,2,rep,name=info,proto3" json:"info" yaml:"info"` + Info CPUInfoS `protobuf:"bytes,2,rep,name=info,proto3,castrepeated=CPUInfoS" json:"info" yaml:"info"` } func (m *CPU) Reset() { *m = CPU{} } @@ -136,7 +138,7 @@ func (m *CPU) GetQuantity() ResourcePair { return ResourcePair{} } -func (m *CPU) GetInfo() []CPUInfo { +func (m *CPU) GetInfo() CPUInfoS { if m != nil { return m.Info } @@ -151,34 +153,34 @@ func init() { func init() { proto.RegisterFile("akash/inventory/v1/cpu.proto", fileDescriptor_ed2b8a0bd798e5a3) } var fileDescriptor_ed2b8a0bd798e5a3 = []byte{ - // 424 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0x31, 0x6f, 0xd4, 0x30, - 0x1c, 0xc5, 0xe3, 0xdc, 0xf5, 0x68, 0x7d, 0x54, 0x48, 0x11, 0x43, 0x28, 0x28, 0x3e, 0x19, 0x55, - 0x3a, 0x06, 0x12, 0xf5, 0x58, 0x10, 0x12, 0xcb, 0x95, 0xa5, 0x03, 0xd2, 0x11, 0x51, 0x06, 0xb6, - 0x34, 0xc9, 0xa5, 0x56, 0x1b, 0x3b, 0xf8, 0x92, 0xa0, 0xfb, 0x16, 0x8c, 0x7c, 0xa4, 0x8a, 0xa9, - 0x23, 0x93, 0x85, 0x92, 0x2d, 0x62, 0xca, 0x27, 0x40, 0xf9, 0xdb, 0x9c, 0x40, 0xed, 0xf6, 0x7f, - 0xef, 0xfd, 0x5f, 0x7e, 0x8a, 0x6d, 0xfc, 0x2c, 0xba, 0x8a, 0x36, 0x97, 0x01, 0xe3, 0x75, 0xca, - 0x4b, 0x21, 0xb7, 0x41, 0x7d, 0x12, 0xc4, 0x45, 0xe5, 0x17, 0x52, 0x94, 0xc2, 0x71, 0x20, 0xf5, - 0x77, 0xa9, 0x5f, 0x9f, 0x1c, 0x3d, 0xce, 0x44, 0x26, 0x20, 0x0e, 0x86, 0x49, 0x6f, 0x1e, 0x1d, - 0xdf, 0xf3, 0x1d, 0x99, 0x6e, 0x44, 0x25, 0xe3, 0xb4, 0x88, 0x98, 0xd4, 0x6b, 0xf4, 0x37, 0xc2, - 0x0f, 0x4e, 0x57, 0xe7, 0x67, 0x7c, 0x2d, 0x9c, 0x17, 0xd8, 0x66, 0x89, 0x8b, 0x66, 0x68, 0x7e, - 0xb0, 0x7c, 0xd2, 0x28, 0x62, 0x9f, 0xbd, 0xeb, 0x14, 0xb1, 0x59, 0xd2, 0x2b, 0x72, 0xb0, 0x8d, - 0xf2, 0xeb, 0x37, 0x94, 0x25, 0x34,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 0xf1, 0xd0, 0xb7, 0xd6, 0xb3, - 0xbe, 0xb7, 0x9e, 0x75, 0xdb, 0x7a, 0xd6, 0xcf, 0xd6, 0xb3, 0x3e, 0x2f, 0x32, 0x56, 0x5e, 0x56, - 0x17, 0x7e, 0x2c, 0xf2, 0x00, 0x78, 0x2f, 0x79, 0x5a, 0x7e, 0x15, 0xf2, 0xca, 0xa8, 0xa8, 0x60, - 0x41, 0x26, 0xfe, 0x7b, 0x20, 0x17, 0x13, 0x78, 0x14, 0xaf, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, - 0x34, 0x07, 0x23, 0x38, 0x85, 0x02, 0x00, 0x00, + // 425 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xcf, 0x6e, 0xd3, 0x30, + 0x18, 0xaf, 0xd3, 0xae, 0x74, 0x2e, 0x13, 0x52, 0xc4, 0x21, 0x0c, 0x94, 0xaf, 0xb2, 0x34, 0xa9, + 0x1c, 0x48, 0xb4, 0x72, 0x41, 0x48, 0x5c, 0x3a, 0x2e, 0x93, 0x40, 0x2a, 0x41, 0xe3, 0xc0, 0x89, + 0xac, 0x49, 0x3b, 0x6b, 0xab, 0x5d, 0xdc, 0x24, 0xa8, 0x6f, 0xc1, 0x73, 0xf0, 0x24, 0x3b, 0xee, + 0x84, 0x38, 0x19, 0x94, 0xde, 0x22, 0x4e, 0x79, 0x02, 0x94, 0xcf, 0x26, 0x02, 0x6d, 0xb7, 0xef, + 0xf7, 0xcf, 0x3f, 0xd9, 0xfe, 0xe8, 0x93, 0xf8, 0x32, 0xde, 0x5c, 0x84, 0x5c, 0x14, 0xa9, 0xc8, + 0xa4, 0xda, 0x86, 0xc5, 0x71, 0x38, 0x5f, 0xe7, 0xc1, 0x5a, 0xc9, 0x4c, 0xba, 0x2e, 0xaa, 0x41, + 0xab, 0x06, 0xc5, 0xf1, 0xe1, 0xc3, 0xa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, 0x77, 0x36, 0x59, 0x69, + 0x68, 0x4f, 0xa9, 0x35, 0x3c, 0x30, 0x95, 0x7f, 0x19, 0x16, 0xb5, 0xa2, 0xfb, 0x89, 0xf6, 0xb8, + 0x58, 0x48, 0xcf, 0x19, 0x75, 0xc7, 0xc3, 0xc9, 0xe3, 0xbb, 0xaa, 0xec, 0x27, 0xb4, 0x2d, 0xbd, + 0x06, 0x55, 0x1a, 0x30, 0x58, 0x6b, 0x18, 0xda, 0x0f, 0x10, 0x0b, 0xc9, 0xbe, 0xfd, 0x84, 0x81, + 0xf5, 0xbf, 0x8f, 0xd0, 0x30, 0x7d, 0x73, 0x5d, 0xfa, 0xe4, 0xa6, 0xf4, 0xc9, 0xaf, 0xd2, 0x27, + 0x5f, 0x77, 0x7e, 0xe7, 0x66, 0xe7, 0x77, 0x7e, 0xec, 0xfc, 0xce, 0xc7, 0xc9, 0x92, 0x67, 0x17, + 0xf9, 0x79, 0x30, 0x97, 0xab, 0x10, 0x7b, 0x9f, 0x89, 0x34, 0xfb, 0x22, 0xd5, 0xa5, 0x45, 0xf1, + 0x9a, 0x87, 0x4b, 0xf9, 0xdf, 0xa2, 0x9c, 0xf7, 0x71, 0x39, 0x9e, 0xff, 0x09, 0x00, 0x00, 0xff, + 0xff, 0xf7, 0x33, 0x13, 0x2d, 0x8d, 0x02, 0x00, 0x00, } func (m *CPUInfo) Marshal() (dAtA []byte, err error) { diff --git a/go/inventory/v1/gpu.go b/go/inventory/v1/gpu.go new file mode 100644 index 00000000..51321b1f --- /dev/null +++ b/go/inventory/v1/gpu.go @@ -0,0 +1,56 @@ +package v1 + +func (s GPUs) Dup() GPUs { + if len(s) == 0 { + return nil + } + + res := make(GPUs, 0, len(s)) + + for _, g := range s { + res = append(res, g.Dup()) + } + + return res +} + +func (r *GPU) Dup() GPU { + res := GPU{ + Quantity: r.Quantity.Dup(), + Info: r.Info.Dup(), + } + + return res +} + +func (s *GPUInfo) Dup() GPUInfo { + res := GPUInfo{ + Vendor: s.Vendor, + Name: s.Name, + ModelID: s.ModelID, + Interface: s.Interface, + MemorySize: s.MemorySize, + } + + return res +} + +func (s GPUInfoS) Dup() GPUInfoS { + if len(s) == 0 { + return nil + } + + res := make(GPUInfoS, 0, len(s)) + + for _, n := range s { + res = append(res, GPUInfo{ + Vendor: n.Vendor, + Name: n.Name, + ModelID: n.ModelID, + Interface: n.Interface, + MemorySize: n.MemorySize, + }) + } + + return res +} diff --git a/go/inventory/v1/gpu.pb.go b/go/inventory/v1/gpu.pb.go index 959aa24d..0aa2f459 100644 --- a/go/inventory/v1/gpu.pb.go +++ b/go/inventory/v1/gpu.pb.go @@ -6,7 +6,7 @@ package v1 import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" + proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" @@ -21,8 +21,9 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// GPUInfo reports GPU details type GPUInfo struct { Vendor string `protobuf:"bytes,1,opt,name=vendor,proto3" json:"vendor" yaml:"vendor"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name" yaml:"name"` @@ -99,9 +100,10 @@ func (m *GPUInfo) GetMemorySize() string { return "" } +// GPUInfo reports GPU inventory details type GPU struct { Quantity ResourcePair `protobuf:"bytes,1,opt,name=quantity,proto3" json:"quantity" yaml:"quantity"` - Info GPUInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info" yaml:"info"` + Info GPUInfoS `protobuf:"bytes,2,rep,name=info,proto3,castrepeated=GPUInfoS" json:"info" yaml:"info"` } func (m *GPU) Reset() { *m = GPU{} } @@ -144,11 +146,11 @@ func (m *GPU) GetQuantity() ResourcePair { return ResourcePair{} } -func (m *GPU) GetInfo() GPUInfo { +func (m *GPU) GetInfo() GPUInfoS { if m != nil { return m.Info } - return GPUInfo{} + return nil } func init() { @@ -159,37 +161,37 @@ func init() { func init() { proto.RegisterFile("akash/inventory/v1/gpu.proto", fileDescriptor_2cc01b12bd00ffcc) } var fileDescriptor_2cc01b12bd00ffcc = []byte{ - // 474 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0x4f, 0x6b, 0xdb, 0x30, - 0x18, 0xc6, 0xe3, 0xd6, 0xcb, 0x1f, 0x85, 0xb1, 0x21, 0x76, 0x30, 0xdd, 0xb0, 0x8a, 0x46, 0x61, - 0x0c, 0x66, 0xd3, 0xe4, 0x36, 0xd8, 0x25, 0x14, 0x4a, 0x60, 0x1d, 0x99, 0xd7, 0xee, 0xb0, 0x4b, - 0x51, 0x13, 0xc5, 0x15, 0xad, 0xa4, 0x4c, 0x71, 0x32, 0xd2, 0x4f, 0xb1, 0xe3, 0x3e, 0x52, 0xd9, - 0xa9, 0xc7, 0x9d, 0xc4, 0x50, 0x0e, 0x83, 0x1c, 0xfd, 0x09, 0x86, 0x64, 0x3b, 0xde, 0x68, 0x6f, - 0x7e, 0x7f, 0xcf, 0xfb, 0x3c, 0x32, 0x7a, 0x04, 0x5e, 0x90, 0x2b, 0x32, 0xbf, 0x8c, 0x99, 0x58, - 0x52, 0x91, 0x49, 0xb5, 0x8a, 0x97, 0x87, 0x71, 0x3a, 0x5b, 0x44, 0x33, 0x25, 0x33, 0x09, 0xa1, - 0x53, 0xa3, 0xad, 0x1a, 0x2d, 0x0f, 0xf7, 0x9e, 0xa5, 0x32, 0x95, 0x4e, 0x8e, 0xed, 0x57, 0xb1, - 0xb9, 0x77, 0xf0, 0x40, 0x8e, 0xa2, 0x73, 0xb9, 0x50, 0x63, 0x3a, 0x23, 0x4c, 0x15, 0x6b, 0xf8, - 0xcf, 0x0e, 0x68, 0x1d, 0x8f, 0xce, 0x86, 0x62, 0x2a, 0xe1, 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0xb6, - 0x72, 0xf7, 0xdc, 0xed, 0xed, 0x47, 0xf7, 0x5b, 0x8d, 0x92, 0xb2, 0xab, 0x11, 0x61, 0x6a, 0x10, - 0xdf, 0x6a, 0xd4, 0x30, 0x1a, 0xb5, 0x3f, 0x96, 0x4e, 0x7b, 0x33, 0x55, 0x4a, 0x7d, 0x33, 0x15, - 0xc1, 0xc9, 0x56, 0x84, 0xa7, 0xc0, 0x67, 0x62, 0x2a, 0x5d, 0x2b, 0xdd, 0xde, 0xf3, 0x87, 0x8e, - 0x2a, 0xfb, 0x1f, 0xbc, 0x2c, 0x4f, 0xf1, 0xed, 0x64, 0x6b, 0xb3, 0xc6, 0xba, 0x36, 0x3b, 0xe1, - 0xc4, 0xc1, 0xc1, 0xe8, 0xd6, 0x84, 0xde, 0x9d, 0x09, 0xbd, 0xdf, 0x26, 0xf4, 0xbe, 0xaf, 0xc3, - 0xc6, 0x8f, 0x75, 0xd8, 0xb8, 0x5b, 0x87, 0x8d, 0x5f, 0xeb, 0xb0, 0xf1, 0xa5, 0x97, 0xb2, 0xec, - 0x72, 0x71, 0x11, 0x8d, 0x25, 0x8f, 0xdd, 0x79, 0x6f, 0x04, 0xcd, 0xbe, 0x49, 0x75, 0x55, 0x4e, - 0x64, 0xc6, 0xe2, 0x54, 0xfe, 0xf7, 0x36, 0x2f, 0x9a, 0xee, 0x3d, 0xf6, 0xff, 0x06, 0x00, 0x00, - 0xff, 0xff, 0x2c, 0x99, 0x43, 0xfe, 0x00, 0x03, 0x00, 0x00, + // 476 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0x4d, 0x6b, 0x13, 0x41, + 0x18, 0xce, 0x26, 0x31, 0x1f, 0x13, 0x44, 0x19, 0x3c, 0x2c, 0x55, 0xf6, 0x0d, 0x03, 0x85, 0x22, + 0xb8, 0x4b, 0x93, 0x9b, 0xe0, 0x25, 0x14, 0x4a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4, 0xfa, 0x33, 0xdf, 0x08, 0x46, 0x27, 0x77, 0x89, 0x63, 0xdd, 0x27, 0x8e, 0xf5, + 0x2b, 0x71, 0xac, 0xaf, 0x5b, 0xa7, 0x76, 0xbf, 0x75, 0x6a, 0x3f, 0xb6, 0x4e, 0xed, 0xe3, 0x20, + 0xe0, 0xf1, 0xd5, 0xea, 0xd2, 0x9d, 0x8a, 0xd0, 0x33, 0x7b, 0x5f, 0x45, 0x2c, 0xfe, 0x22, 0xe4, + 0x75, 0x3e, 0xd1, 0x05, 0xf7, 0x02, 0xf1, 0xcf, 0x1b, 0xbd, 0x6c, 0x99, 0x77, 0x39, 0xfc, 0x13, + 0x00, 0x00, 0xff, 0xff, 0x73, 0xf7, 0x44, 0x3a, 0x08, 0x03, 0x00, 0x00, } func (m *GPUInfo) Marshal() (dAtA []byte, err error) { @@ -270,16 +272,20 @@ func (m *GPU) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.Info) > 0 { + for iNdEx := len(m.Info) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Info[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGpu(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - i -= size - i = encodeVarintGpu(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0x12 { size, err := m.Quantity.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -341,8 +347,12 @@ func (m *GPU) Size() (n int) { _ = l l = m.Quantity.Size() n += 1 + l + sovGpu(uint64(l)) - l = m.Info.Size() - n += 1 + l + sovGpu(uint64(l)) + if len(m.Info) > 0 { + for _, e := range m.Info { + l = e.Size() + n += 1 + l + sovGpu(uint64(l)) + } + } return n } @@ -653,7 +663,8 @@ func (m *GPU) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Info.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Info = append(m.Info, GPUInfo{}) + if err := m.Info[len(m.Info)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/go/inventory/v1/memory.go b/go/inventory/v1/memory.go new file mode 100644 index 00000000..de8ff167 --- /dev/null +++ b/go/inventory/v1/memory.go @@ -0,0 +1,29 @@ +package v1 + +func (r *Memory) Dup() Memory { + res := Memory{ + Quantity: r.Quantity.Dup(), + Info: r.Info.Dup(), + } + + return res +} + +func (s MemoryInfoS) Dup() MemoryInfoS { + if len(s) == 0 { + return nil + } + + res := make(MemoryInfoS, 0, len(s)) + + for _, n := range s { + res = append(res, MemoryInfo{ + Vendor: n.Vendor, + Type: n.Type, + TotalSize: n.TotalSize, + Speed: n.Speed, + }) + } + + return res +} diff --git a/go/inventory/v1/memory.pb.go b/go/inventory/v1/memory.pb.go index 7ec90ca4..036cdeb6 100644 --- a/go/inventory/v1/memory.pb.go +++ b/go/inventory/v1/memory.pb.go @@ -6,7 +6,7 @@ package v1 import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" + proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" @@ -21,8 +21,9 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// MemoryInfo reports Memory details type MemoryInfo struct { Vendor string `protobuf:"bytes,1,opt,name=vendor,proto3" json:"vendor" yaml:"vendor"` Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type" yaml:"type"` @@ -91,9 +92,10 @@ func (m *MemoryInfo) GetSpeed() string { return "" } +// Memory reports Memory inventory details type Memory struct { Quantity ResourcePair `protobuf:"bytes,1,opt,name=quantity,proto3" json:"quantity" yaml:"quantity"` - Info []MemoryInfo `protobuf:"bytes,2,rep,name=info,proto3" json:"info" yaml:"info"` + Info MemoryInfoS `protobuf:"bytes,2,rep,name=info,proto3,castrepeated=MemoryInfoS" json:"info" yaml:"info"` } func (m *Memory) Reset() { *m = Memory{} } @@ -136,7 +138,7 @@ func (m *Memory) GetQuantity() ResourcePair { return ResourcePair{} } -func (m *Memory) GetInfo() []MemoryInfo { +func (m *Memory) GetInfo() MemoryInfoS { if m != nil { return m.Info } @@ -151,35 +153,35 @@ func init() { func init() { proto.RegisterFile("akash/inventory/v1/memory.proto", fileDescriptor_bf744888c94a0308) } var fileDescriptor_bf744888c94a0308 = []byte{ - // 435 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0x3f, 0x6f, 0x13, 0x31, - 0x1c, 0xbd, 0x4b, 0xaf, 0x51, 0xe3, 0x80, 0x10, 0x16, 0xc3, 0xa9, 0x83, 0x7f, 0x91, 0x51, 0xa5, - 0x2e, 0xdc, 0xd1, 0x74, 0x41, 0x48, 0x2c, 0xd9, 0x18, 0x10, 0xe5, 0x5a, 0x81, 0xc4, 0x82, 0xdc, - 0xd6, 0x4d, 0xad, 0xf6, 0xce, 0x87, 0xe3, 0x04, 0x5d, 0xbf, 0x02, 0x0b, 0x23, 0x1f, 0xa9, 0x63, - 0x46, 0x26, 0x0b, 0x39, 0x5b, 0xc6, 0xfb, 0x04, 0xc8, 0xf6, 0x35, 0x05, 0xd1, 0xed, 0xde, 0xfb, - 0xbd, 0x3f, 0xd2, 0x3b, 0x23, 0x60, 0x57, 0x6c, 0x76, 0x99, 0x8b, 0x6a, 0xc1, 0x2b, 0x2d, 0x55, - 0x93, 0x2f, 0x0e, 0xf2, 0x92, 0x97, 0x52, 0x35, 0x59, 0xad, 0xa4, 0x96, 0x18, 0x7b, 0x41, 0xb6, - 0x11, 0x64, 0x8b, 0x83, 0xdd, 0x67, 0x53, 0x39, 0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ff, 0xf8, 0x59, 0xd1, 0x4d, - 0x7a, 0xc4, 0x84, 0x9a, 0xe4, 0xb7, 0x06, 0x22, 0x6b, 0x60, 0xe7, 0x43, 0xe7, 0x5c, 0x1b, 0xd8, - 0xa4, 0xb4, 0x06, 0x9e, 0x84, 0xce, 0x3b, 0x86, 0x16, 0x9b, 0x23, 0xfe, 0x84, 0x12, 0x51, 0x5d, - 0xc8, 0xb4, 0x37, 0xda, 0xda, 0x1f, 0x8e, 0xc9, 0x43, 0x55, 0xf7, 0xbf, 0x69, 0xf2, 0xbc, 0x2b, - 0x4a, 0x1c, 0x72, 0xeb, 0x3a, 0xef, 0xfd, 0xba, 0x0e, 0xd1, 0xc2, 0x93, 0x93, 0xa3, 0x5b, 0x4b, - 0xe2, 0xa5, 0x25, 0xf1, 0x6f, 0x4b, 0xe2, 0x1f, 0x2b, 0x12, 0xfd, 0x5c, 0x91, 0x68, 0xb9, 0x22, - 0xd1, 0xaf, 0x15, 0x89, 0x3e, 0x8f, 0xa7, 0x42, 0x5f, 0xce, 0x4f, 0xb3, 0x33, 0x59, 0xe6, 0xbe, - 0xf2, 0x45, 0xc5, 0xf5, 0x37, 0xa9, 0xae, 0x3a, 0xc4, 0x6a, 0x91, 0x4f, 0xe5, 0x3f, 0xaf, 0xe8, - 0xb4, 0xef, 0x5f, 0xce, 0xe1, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x82, 0x38, 0x06, 0x7c, 0xad, - 0x02, 0x00, 0x00, + // 438 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xbf, 0x6e, 0xd3, 0x40, + 0x1c, 0x8e, 0x53, 0x37, 0x6a, 0x2e, 0x20, 0xc4, 0x89, 0xc1, 0xea, 0xe0, 0x5f, 0x74, 0x52, 0xa5, + 0x2e, 0xd8, 0x34, 0x5d, 0x10, 0x12, 0x4b, 0x36, 0x24, 0x10, 0x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, 0x4c, 0x7d, 0x13, 0xf2, 0xb2, 0x45, 0xb4, 0xe4, 0xe9, 0x42, + 0xfc, 0xf3, 0xa0, 0x4e, 0x07, 0xee, 0x11, 0x1d, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x8f, 0xd0, + 0x7e, 0x48, 0xb8, 0x02, 0x00, 0x00, } func (m *MemoryInfo) Marshal() (dAtA []byte, err error) { diff --git a/go/inventory/v1/node.go b/go/inventory/v1/node.go new file mode 100644 index 00000000..bfde9bec --- /dev/null +++ b/go/inventory/v1/node.go @@ -0,0 +1,21 @@ +package v1 + +func (nd Nodes) Dup() Nodes { + res := make(Nodes, 0, len(nd)) + + for _, n := range nd { + res = append(res, n.Dup()) + } + return res +} + +func (nd *Node) Dup() Node { + res := Node{ + CPU: nd.CPU.Dup(), + GPU: nd.GPU.Dup(), + Memory: nd.Memory.Dup(), + EphemeralStorage: nd.EphemeralStorage.Dup(), + } + + return res +} diff --git a/go/inventory/v1/node.pb.go b/go/inventory/v1/node.pb.go index e7302df7..038729d4 100644 --- a/go/inventory/v1/node.pb.go +++ b/go/inventory/v1/node.pb.go @@ -23,11 +23,12 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// Node reports node inventory details type Node struct { - CPU CPU `protobuf:"bytes,1,opt,name=cpu,proto3" json:"cpu" yaml:"cpu"` - Memory Memory `protobuf:"bytes,2,opt,name=memory,proto3" json:"memory" yaml:"memory"` - Gpus GPUs `protobuf:"bytes,3,rep,name=gpu,proto3,castrepeated=GPUs" json:"gpus" yaml:"gpus"` - Storage ClusterStorage `protobuf:"bytes,4,rep,name=storage,proto3,castrepeated=ClusterStorage" json:"storage" yaml:"storage"` + CPU CPU `protobuf:"bytes,1,opt,name=cpu,proto3" json:"cpu" yaml:"cpu"` + Memory Memory `protobuf:"bytes,2,opt,name=memory,proto3" json:"memory" yaml:"memory"` + GPU GPU `protobuf:"bytes,3,opt,name=gpu,proto3,castrepeated=GPUs" json:"gpu" yaml:"gpu"` + EphemeralStorage Storage `protobuf:"bytes,4,opt,name=storage,proto3" json:"EphemeralStorage" yaml:"EphemeralStorage"` } func (m *Node) Reset() { *m = Node{} } @@ -77,18 +78,18 @@ func (m *Node) GetMemory() Memory { return Memory{} } -func (m *Node) GetGpus() GPUs { +func (m *Node) GetGPU() GPU { if m != nil { - return m.Gpus + return m.GPU } - return nil + return GPU{} } -func (m *Node) GetStorage() ClusterStorage { +func (m *Node) GetEphemeralStorage() Storage { if m != nil { - return m.Storage + return m.EphemeralStorage } - return nil + return Storage{} } func init() { @@ -98,32 +99,31 @@ func init() { func init() { proto.RegisterFile("akash/inventory/v1/node.proto", fileDescriptor_5f97c0fb35079221) } var fileDescriptor_5f97c0fb35079221 = []byte{ - // 389 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xbd, 0x8e, 0x9b, 0x40, - 0x14, 0x85, 0x21, 0x20, 0x5b, 0xc2, 0x8a, 0x0b, 0x14, 0x29, 0x88, 0x24, 0x0c, 0xa2, 0x4a, 0x14, - 0x05, 0x64, 0xa7, 0x4b, 0x91, 0x02, 0x17, 0x2e, 0xf2, 0x23, 0x44, 0x44, 0x8a, 0x48, 0x29, 0x30, - 0x46, 0x63, 0xcb, 0x86, 0x19, 0x01, 0xe3, 0xc8, 0x65, 0xde, 0x60, 0x9f, 0x63, 0x9f, 0xc4, 0xa5, - 0xcb, 0xad, 0x66, 0x57, 0xb8, 0xa3, 0xe4, 0x09, 0x56, 0xcc, 0x8c, 0x2d, 0xad, 0x96, 0xdd, 0x8e, - 0x73, 0xcf, 0xb9, 0xdf, 0x3d, 0x62, 0xb4, 0x77, 0xf1, 0x26, 0x2e, 0x57, 0xde, 0x3a, 0xdf, 0xa5, - 0x79, 0x85, 0x8a, 0xbd, 0xb7, 0x9b, 0x78, 0x39, 0x5a, 0xa6, 0x2e, 0x2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xd8, 0xbf, 0x78, 0xc4, 0xff, 0x2a, 0xf8, 0x43, 0x31, 0x68, 0x28, 0x38, 0xaf, 0xb7, - 0x14, 0x8c, 0xf9, 0x15, 0x31, 0xe8, 0x0e, 0x8d, 0x67, 0x5b, 0x52, 0x56, 0x69, 0x21, 0xe2, 0xe1, - 0x39, 0xec, 0x7f, 0x3f, 0xd4, 0x96, 0x7c, 0xac, 0x2d, 0xf9, 0xae, 0xb6, 0xe4, 0xab, 0x93, 0x25, - 0x1d, 0x4f, 0x96, 0x74, 0x73, 0xb2, 0xa4, 0x3f, 0x53, 0xb8, 0xae, 0x56, 0x64, 0xe1, 0x26, 0x28, - 0xf3, 0x58, 0x93, 0x4f, 0x79, 0x5a, 0xfd, 0x43, 0xc5, 0x46, 0xa8, 0x18, 0xaf, 0x3d, 0x88, 0x1e, - 0x3c, 0xef, 0x62, 0xc0, 0x1e, 0xf6, 0xf3, 0x7d, 0x00, 0x00, 0x00, 0xff, 0xff, 0xca, 0x35, 0xfe, - 0x8f, 0xa2, 0x02, 0x00, 0x00, + // 374 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x3d, 0x6b, 0xbb, 0x40, + 0x1c, 0xc7, 0xf5, 0x6f, 0xc8, 0x1f, 0x2c, 0x85, 0x22, 0x85, 0x88, 0x6d, 0xbd, 0xe0, 0x94, 0x0e, + 0x55, 0x92, 0x6e, 0x1d, 0x0d, 0xc5, 0xa1, 0x0f, 0x88, 0xc1, 0xa5, 0xd0, 0xc1, 0x18, 0xb9, 0x84, + 0x44, 0xef, 0x30, 0x9a, 0x92, 0xa5, 0x6b, 0xd7, 0xbe, 0x8e, 0xbe, 0x92, 0x8c, 0x19, 0x3b, 0x5d, + 0x8b, 0xd9, 0x32, 0xe6, 0x15, 0x14, 0xef, 0x2e, 0xa1, 0x0f, 0xb6, 0x9b, 0xbf, 0xfb, 0x7c, 0xef,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0xeb, 0x4f, 0xbd, 0x12, 0x29, 0x8f, 0xf2, 0x7f, 0xfe, + 0xef, 0xd4, 0x1a, 0x2d, 0x3e, 0xaa, 0x2a, 0xee, 0xb1, 0x88, 0xed, 0xf0, 0xf2, 0x83, 0x4b, 0x3c, + 0x8c, 0xe2, 0x28, 0x0d, 0x26, 0x9c, 0xac, 0x2b, 0xce, 0x36, 0x04, 0x34, 0xd8, 0xda, 0xef, 0xc4, + 0xf0, 0xb6, 0x4b, 0xed, 0xeb, 0x45, 0xa1, 0x8b, 0xcb, 0x42, 0x17, 0xdf, 0x0b, 0x5d, 0x7c, 0x5e, + 0xe9, 0xc2, 0x72, 0xa5, 0x0b, 0xaf, 0x2b, 0x5d, 0xb8, 0xeb, 0xc0, 0x51, 0x36, 0xcc, 0xfb, 0x66, + 0x88, 0x62, 0x8b, 0x2a, 0x9d, 0x25, 0x51, 0xf6, 0x80, 0xd2, 0x31, 0x9f, 0x02, 0x3c, 0xb2, 0x20, + 0xfa, 0xf2, 0xc8, 0xfd, 0x3a, 0x7d, 0xde, 0xf3, 0x8f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x3d, + 0xc9, 0x60, 0xa8, 0x02, 0x00, 0x00, } func (m *Node) Marshal() (dAtA []byte, err error) { @@ -146,34 +146,26 @@ func (m *Node) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Storage) > 0 { - for iNdEx := len(m.Storage) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Storage[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNode(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 + { + size, err := m.EphemeralStorage.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintNode(dAtA, i, uint64(size)) } - if len(m.Gpus) > 0 { - for iNdEx := len(m.Gpus) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Gpus[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNode(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a + i-- + dAtA[i] = 0x22 + { + size, err := m.GPU.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintNode(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x1a { size, err := m.Memory.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -218,18 +210,10 @@ func (m *Node) Size() (n int) { n += 1 + l + sovNode(uint64(l)) l = m.Memory.Size() n += 1 + l + sovNode(uint64(l)) - if len(m.Gpus) > 0 { - for _, e := range m.Gpus { - l = e.Size() - n += 1 + l + sovNode(uint64(l)) - } - } - if len(m.Storage) > 0 { - for _, e := range m.Storage { - l = e.Size() - n += 1 + l + sovNode(uint64(l)) - } - } + l = m.GPU.Size() + n += 1 + l + sovNode(uint64(l)) + l = m.EphemeralStorage.Size() + n += 1 + l + sovNode(uint64(l)) return n } @@ -336,7 +320,7 @@ func (m *Node) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Gpus", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field GPU", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -363,14 +347,13 @@ func (m *Node) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Gpus = append(m.Gpus, GPU{}) - if err := m.Gpus[len(m.Gpus)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.GPU.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Storage", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field EphemeralStorage", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -397,8 +380,7 @@ func (m *Node) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Storage = append(m.Storage, Storage{}) - if err := m.Storage[len(m.Storage)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.EphemeralStorage.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/go/inventory/v1/resourcepair.go b/go/inventory/v1/resourcepair.go index 1eef26e4..f01980e9 100644 --- a/go/inventory/v1/resourcepair.go +++ b/go/inventory/v1/resourcepair.go @@ -5,7 +5,7 @@ func (m *ResourcePair) Equal(rhs ResourcePair) bool { return false } - return (m.Allocatable.Cmp(rhs.Allocatable) == 0) && (m.Allocated.Cmp(rhs.Allocated) == 0) + return (m.Allocatable.Cmp(*rhs.Allocatable) == 0) && (m.Allocated.Cmp(*rhs.Allocated) == 0) } func (m *ResourcePair) LT(rhs ResourcePair) bool { @@ -13,5 +13,18 @@ func (m *ResourcePair) LT(rhs ResourcePair) bool { return false } - return m.Allocatable.Cmp(rhs.Allocatable) == -1 + return m.Allocatable.Cmp(*rhs.Allocatable) == -1 +} + +func (m *ResourcePair) Dup() ResourcePair { + allocatable := m.Allocatable.DeepCopy() + allocated := m.Allocated.DeepCopy() + + res := ResourcePair{ + Allocatable: &allocatable, + Allocated: &allocated, + Attributes: m.Attributes.Dup(), + } + + return res } diff --git a/go/inventory/v1/resourcepair.pb.go b/go/inventory/v1/resourcepair.pb.go index 2144eaf2..93e241bd 100644 --- a/go/inventory/v1/resourcepair.pb.go +++ b/go/inventory/v1/resourcepair.pb.go @@ -5,9 +5,10 @@ package v1 import ( fmt "fmt" + github_com_akash_network_akash_api_go_node_types_v1beta3 "github.com/akash-network/akash-api/go/node/types/v1beta3" v1beta3 "github.com/akash-network/akash-api/go/node/types/v1beta3" _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" + proto "github.com/gogo/protobuf/proto" io "io" resource "k8s.io/apimachinery/pkg/api/resource" math "math" @@ -23,12 +24,13 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// ResourcePair to extents resource.Quantity to provide total and available units of the resource type ResourcePair struct { - Allocatable resource.Quantity `protobuf:"bytes,1,opt,name=allocatable,proto3" json:"allocatable" yaml:"allocatable"` - Allocated resource.Quantity `protobuf:"bytes,2,opt,name=allocated,proto3" json:"allocated" yaml:"allocated"` - Attributes []*v1beta3.Attribute `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty" yaml:"attributes,omitempty"` + Allocatable *resource.Quantity `protobuf:"bytes,1,opt,name=allocatable,proto3" json:"allocatable" yaml:"allocatable"` + Allocated *resource.Quantity `protobuf:"bytes,2,opt,name=allocated,proto3" json:"allocated" yaml:"allocated"` + Attributes github_com_akash_network_akash_api_go_node_types_v1beta3.Attributes `protobuf:"bytes,3,rep,name=attributes,proto3,castrepeated=github.com/akash-network/akash-api/go/node/types/v1beta3.Attributes" json:"attributes,omitempty" yaml:"attributes,omitempty"` } func (m *ResourcePair) Reset() { *m = ResourcePair{} } @@ -64,21 +66,21 @@ func (m *ResourcePair) XXX_DiscardUnknown() { var xxx_messageInfo_ResourcePair proto.InternalMessageInfo -func (m *ResourcePair) GetAllocatable() resource.Quantity { +func (m *ResourcePair) GetAllocatable() *resource.Quantity { if m != nil { return m.Allocatable } - return resource.Quantity{} + return nil } -func (m *ResourcePair) GetAllocated() resource.Quantity { +func (m *ResourcePair) GetAllocated() *resource.Quantity { if m != nil { return m.Allocated } - return resource.Quantity{} + return nil } -func (m *ResourcePair) GetAttributes() []*v1beta3.Attribute { +func (m *ResourcePair) GetAttributes() github_com_akash_network_akash_api_go_node_types_v1beta3.Attributes { if m != nil { return m.Attributes } @@ -94,33 +96,34 @@ func init() { } var fileDescriptor_995cee7bf7b692e7 = []byte{ - // 407 bytes of a gzipped FileDescriptorProto - 0x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0x26, 0x77, - 0xb9, 0x87, 0x7c, 0x1e, 0xe3, 0x36, 0xd5, 0xfb, 0x84, 0xca, 0x2f, 0x5c, 0x84, 0xfd, 0xd4, 0xb4, - 0x1f, 0xf0, 0x9b, 0x7f, 0xd1, 0x7b, 0xd1, 0x76, 0x3f, 0xff, 0x1b, 0x00, 0x00, 0xff, 0xff, 0xc8, - 0xb9, 0xff, 0x7b, 0xa8, 0x02, 0x00, 0x00, + // 425 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x3d, 0x8f, 0xd3, 0x30, + 0x18, 0x8e, 0x29, 0x42, 0xba, 0x94, 0x01, 0x45, 0x37, 0x54, 0x87, 0x88, 0x4f, 0x91, 0x90, 0x6e, + 0x00, 0x5b, 0xed, 0x31, 0x9c, 0x6e, 0x6b, 0x59, 0x19, 0x20, 0x23, 0x9b, 0x93, 0xbc, 0x4a, 0xad, + 0x7c, 0x38, 0x72, 0x9c, 0xa0, 0x6c, 0x88, 0x91, 0x89, 0x9f, 0xc0, 0xcc, 0xcf, 0x60, 0xea, 0xd8, + 0x91, 0xc9, 0xa0, 0x74, 0x81, 0x8e, 0xfd, 0x05, 0x28, 0x1f, 0x6d, 0x82, 0x60, 0x40, 0xb7, 0xd9, + 0xef, 0xfb, 0x7c, 0x49, 0xcf, 0x6b, 0x3e, 0x65, 0x11, 0xcb, 0xd7, 0x94, 0xa7, 0x25, 0xa4, 0x4a, + 0xc8, 0x8a, 0x96, 0x73, 0x2a, 0x21, 0x17, 0x85, 0xf4, 0x21, 0x63, 0x5c, 0x92, 0x4c, 0x0a, 0x25, + 0x2c, 0xab, 0x85, 0x91, 0x13, 0x8c, 0x94, 0xf3, 0x0b, 0xa7, 0xa3, 0x7a, 0x2c, 0x07, 0x5a, 0xce, + 0x3d, 0x50, 0xec, 0x9a, 0x32, 0xa5, 0x24, 0xf7, 0x0a, 0x05, 0x1d, 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0xb8, 0x82, 0x24, 0x53, 0xd5, 0x41, 0xe3, 0xc7, 0xbd, 0xe3, 0x3f, 0xb6, 0xce, 0x97, 0xef, + 0xf8, 0x65, 0xc8, 0xd5, 0xba, 0xf0, 0x88, 0x2f, 0x12, 0xda, 0x1a, 0x3d, 0x4f, 0x41, 0xbd, 0x13, + 0x32, 0xea, 0x7f, 0x4d, 0xa3, 0xa1, 0xa0, 0xa9, 0x08, 0x80, 0xaa, 0x2a, 0x83, 0x9c, 0xfe, 0x95, + 0x21, 0x77, 0x47, 0xa9, 0x6f, 0xef, 0xff, 0xfc, 0x8c, 0x8d, 0xd5, 0xab, 0x4d, 0x6d, 0xa3, 0x6d, + 0x6d, 0xa3, 0x1f, 0xb5, 0x8d, 0x3e, 0xed, 0x6c, 0x63, 0xbb, 0xb3, 0x8d, 0x6f, 0x3b, 0xdb, 0x78, + 0xbb, 0xf8, 0x3f, 0xc3, 0xf1, 0x41, 0x7b, 0x0f, 0xda, 0x03, 0xba, 0xfe, 0x1d, 0x00, 0x00, 0xff, + 0xff, 0x97, 0xe9, 0xcc, 0xe0, 0xed, 0x02, 0x00, 0x00, } func (m *ResourcePair) Marshal() (dAtA []byte, err error) { @@ -157,26 +160,30 @@ func (m *ResourcePair) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x1a } } - { - size, err := m.Allocated.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.Allocated != nil { + { + size, err := m.Allocated.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintResourcepair(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintResourcepair(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x12 - { - size, err := m.Allocatable.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if m.Allocatable != nil { + { + size, err := m.Allocatable.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintResourcepair(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintResourcepair(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -197,10 +204,14 @@ func (m *ResourcePair) Size() (n int) { } var l int _ = l - l = m.Allocatable.Size() - n += 1 + l + sovResourcepair(uint64(l)) - l = m.Allocated.Size() - n += 1 + l + sovResourcepair(uint64(l)) + if m.Allocatable != nil { + l = m.Allocatable.Size() + n += 1 + l + sovResourcepair(uint64(l)) + } + if m.Allocated != nil { + l = m.Allocated.Size() + n += 1 + l + sovResourcepair(uint64(l)) + } if len(m.Attributes) > 0 { for _, e := range m.Attributes { l = e.Size() @@ -274,6 +285,9 @@ func (m *ResourcePair) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.Allocatable == nil { + m.Allocatable = &resource.Quantity{} + } if err := m.Allocatable.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -307,6 +321,9 @@ func (m *ResourcePair) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } + if m.Allocated == nil { + m.Allocated = &resource.Quantity{} + } if err := m.Allocated.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -340,7 +357,7 @@ func (m *ResourcePair) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Attributes = append(m.Attributes, &v1beta3.Attribute{}) + m.Attributes = append(m.Attributes, v1beta3.Attribute{}) if err := m.Attributes[len(m.Attributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/go/inventory/v1/service.pb.go b/go/inventory/v1/service.pb.go index ffe06c2b..838d37d7 100644 --- a/go/inventory/v1/service.pb.go +++ b/go/inventory/v1/service.pb.go @@ -27,6 +27,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// voidNoParam dummy param for RPC services type VoidNoParam struct { } @@ -64,26 +65,28 @@ func (m *VoidNoParam) XXX_DiscardUnknown() { var xxx_messageInfo_VoidNoParam proto.InternalMessageInfo func init() { - proto.RegisterType((*VoidNoParam)(nil), "akash.inventory.v1.voidNoParam") + proto.RegisterType((*VoidNoParam)(nil), "akash.inventory.v1.VoidNoParam") } func init() { proto.RegisterFile("akash/inventory/v1/service.proto", fileDescriptor_19b1fad552cee5dc) } var fileDescriptor_19b1fad552cee5dc = []byte{ - // 195 bytes of a gzipped FileDescriptorProto + // 235 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xcc, 0x4e, 0x2c, 0xce, 0xd0, 0xcf, 0xcc, 0x2b, 0x4b, 0xcd, 0x2b, 0xc9, 0x2f, 0xaa, 0xd4, 0x2f, 0x33, 0xd4, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x02, 0xab, 0xd0, 0x83, 0xab, 0xd0, 0x2b, 0x33, 0x94, 0x92, 0xc5, 0xa2, 0x2b, 0x2f, 0x3f, 0x05, 0xaa, 0x45, - 0x89, 0x97, 0x8b, 0xbb, 0x2c, 0x3f, 0x33, 0xc5, 0x2f, 0x3f, 0x20, 0xb1, 0x28, 0x31, 0xd7, 0xc8, - 0x9f, 0x8b, 0xd9, 0xb7, 0x38, 0x5d, 0xc8, 0x83, 0x8b, 0x33, 0xb0, 0x34, 0xb5, 0xa8, 0xd2, 0x2f, - 0x3f, 0x25, 0x55, 0x48, 0x5e, 0x0f, 0xd3, 0x58, 0x3d, 0x24, 0x4d, 0x52, 0x12, 0xd8, 0x14, 0x80, - 0xb4, 0x1a, 0x30, 0x3a, 0xf9, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, - 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, - 0x51, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0x58, 0xbf, 0x6e, 0x5e, - 0x6a, 0x49, 0x79, 0x7e, 0x51, 0x36, 0x94, 0x97, 0x58, 0x90, 0xa9, 0x9f, 0x9e, 0x8f, 0xe2, 0xf0, - 0x24, 0x36, 0xb0, 0xa3, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb1, 0x12, 0x83, 0xba, 0x0b, - 0x01, 0x00, 0x00, + 0x0a, 0x9b, 0xa1, 0xc9, 0x39, 0xa5, 0xc5, 0x25, 0xa9, 0x45, 0x10, 0x15, 0x4a, 0xbc, 0x5c, 0xdc, + 0x61, 0xf9, 0x99, 0x29, 0x7e, 0xf9, 0x01, 0x89, 0x45, 0x89, 0xb9, 0x46, 0xc1, 0x5c, 0xec, 0x7e, + 0xf9, 0x29, 0xa9, 0x41, 0x01, 0xce, 0x42, 0x1e, 0x5c, 0x9c, 0x81, 0xa5, 0xa9, 0x45, 0x95, 0x20, + 0xbe, 0x90, 0xbc, 0x1e, 0xa6, 0xe5, 0x7a, 0x48, 0x1a, 0xa5, 0x24, 0xb0, 0x29, 0x00, 0x69, 0x35, + 0x60, 0x34, 0x8a, 0xe1, 0xe2, 0x72, 0x86, 0x58, 0x0a, 0x32, 0xd7, 0x8f, 0x8b, 0x07, 0x6c, 0x2e, + 0x54, 0x88, 0xb0, 0xd1, 0xd2, 0xd8, 0x14, 0x40, 0x75, 0x1b, 0x30, 0x3a, 0xf9, 0x9c, 0x78, 0x24, + 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, + 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x51, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, + 0x72, 0x7e, 0xae, 0x3e, 0xd8, 0x08, 0xdd, 0xbc, 0xd4, 0x92, 0xf2, 0xfc, 0xa2, 0x6c, 0x28, 0x2f, + 0xb1, 0x20, 0x53, 0x3f, 0x3d, 0x1f, 0x25, 0x74, 0x92, 0xd8, 0xc0, 0xc1, 0x62, 0x0c, 0x08, 0x00, + 0x00, 0xff, 0xff, 0x6b, 0xf3, 0xa2, 0xf8, 0x8f, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -94,28 +97,30 @@ var _ grpc.ClientConn // is compatible with the grpc package it is being compiled against. const _ = grpc.SupportPackageIsVersion4 -// MsgClient is the client API for Msg service. +// NodeRPCClient is the client API for NodeRPC service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - // QueryNode defines a method to query an Akash Provider worker node specs - QueryNode(ctx context.Context, in *VoidNoParam, opts ...grpc.CallOption) (Msg_QueryNodeClient, error) +type NodeRPCClient interface { + // QueryNode defines a method to query and stream hardware state of the node + // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + QueryNode(ctx context.Context, in *VoidNoParam, opts ...grpc.CallOption) (NodeRPC_QueryNodeClient, error) } -type msgClient struct { +type nodeRPCClient struct { cc grpc1.ClientConn } -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} +func NewNodeRPCClient(cc grpc1.ClientConn) NodeRPCClient { + return &nodeRPCClient{cc} } -func (c *msgClient) QueryNode(ctx context.Context, in *VoidNoParam, opts ...grpc.CallOption) (Msg_QueryNodeClient, error) { - stream, err := c.cc.NewStream(ctx, &_Msg_serviceDesc.Streams[0], "/akash.inventory.v1.Msg/QueryNode", opts...) +func (c *nodeRPCClient) QueryNode(ctx context.Context, in *VoidNoParam, opts ...grpc.CallOption) (NodeRPC_QueryNodeClient, error) { + stream, err := c.cc.NewStream(ctx, &_NodeRPC_serviceDesc.Streams[0], "/akash.inventory.v1.NodeRPC/QueryNode", opts...) if err != nil { return nil, err } - x := &msgQueryNodeClient{stream} + x := &nodeRPCQueryNodeClient{stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -125,16 +130,16 @@ func (c *msgClient) QueryNode(ctx context.Context, in *VoidNoParam, opts ...grpc return x, nil } -type Msg_QueryNodeClient interface { +type NodeRPC_QueryNodeClient interface { Recv() (*Node, error) grpc.ClientStream } -type msgQueryNodeClient struct { +type nodeRPCQueryNodeClient struct { grpc.ClientStream } -func (x *msgQueryNodeClient) Recv() (*Node, error) { +func (x *nodeRPCQueryNodeClient) Recv() (*Node, error) { m := new(Node) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err @@ -142,53 +147,160 @@ func (x *msgQueryNodeClient) Recv() (*Node, error) { return m, nil } -// MsgServer is the server API for Msg service. -type MsgServer interface { - // QueryNode defines a method to query an Akash Provider worker node specs - QueryNode(*VoidNoParam, Msg_QueryNodeServer) error +// NodeRPCServer is the server API for NodeRPC service. +type NodeRPCServer interface { + // QueryNode defines a method to query and stream hardware state of the node + // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + QueryNode(*VoidNoParam, NodeRPC_QueryNodeServer) error } -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { +// UnimplementedNodeRPCServer can be embedded to have forward compatible implementations. +type UnimplementedNodeRPCServer struct { } -func (*UnimplementedMsgServer) QueryNode(req *VoidNoParam, srv Msg_QueryNodeServer) error { +func (*UnimplementedNodeRPCServer) QueryNode(req *VoidNoParam, srv NodeRPC_QueryNodeServer) error { return status.Errorf(codes.Unimplemented, "method QueryNode not implemented") } -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) +func RegisterNodeRPCServer(s grpc1.Server, srv NodeRPCServer) { + s.RegisterService(&_NodeRPC_serviceDesc, srv) } -func _Msg_QueryNode_Handler(srv interface{}, stream grpc.ServerStream) error { +func _NodeRPC_QueryNode_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(VoidNoParam) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(MsgServer).QueryNode(m, &msgQueryNodeServer{stream}) + return srv.(NodeRPCServer).QueryNode(m, &nodeRPCQueryNodeServer{stream}) } -type Msg_QueryNodeServer interface { +type NodeRPC_QueryNodeServer interface { Send(*Node) error grpc.ServerStream } -type msgQueryNodeServer struct { +type nodeRPCQueryNodeServer struct { grpc.ServerStream } -func (x *msgQueryNodeServer) Send(m *Node) error { +func (x *nodeRPCQueryNodeServer) Send(m *Node) error { return x.ServerStream.SendMsg(m) } -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "akash.inventory.v1.Msg", - HandlerType: (*MsgServer)(nil), +var _NodeRPC_serviceDesc = grpc.ServiceDesc{ + ServiceName: "akash.inventory.v1.NodeRPC", + HandlerType: (*NodeRPCServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{ { StreamName: "QueryNode", - Handler: _Msg_QueryNode_Handler, + Handler: _NodeRPC_QueryNode_Handler, + ServerStreams: true, + }, + }, + Metadata: "akash/inventory/v1/service.proto", +} + +// ClusterRPCClient is the client API for ClusterRPC service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type ClusterRPCClient interface { + // QueryNode defines a method to query and stream hardware state of the cluster + // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + QueryCluster(ctx context.Context, in *VoidNoParam, opts ...grpc.CallOption) (ClusterRPC_QueryClusterClient, error) +} + +type clusterRPCClient struct { + cc grpc1.ClientConn +} + +func NewClusterRPCClient(cc grpc1.ClientConn) ClusterRPCClient { + return &clusterRPCClient{cc} +} + +func (c *clusterRPCClient) QueryCluster(ctx context.Context, in *VoidNoParam, opts ...grpc.CallOption) (ClusterRPC_QueryClusterClient, error) { + stream, err := c.cc.NewStream(ctx, &_ClusterRPC_serviceDesc.Streams[0], "/akash.inventory.v1.ClusterRPC/QueryCluster", opts...) + if err != nil { + return nil, err + } + x := &clusterRPCQueryClusterClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type ClusterRPC_QueryClusterClient interface { + Recv() (*Cluster, error) + grpc.ClientStream +} + +type clusterRPCQueryClusterClient struct { + grpc.ClientStream +} + +func (x *clusterRPCQueryClusterClient) Recv() (*Cluster, error) { + m := new(Cluster) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// ClusterRPCServer is the server API for ClusterRPC service. +type ClusterRPCServer interface { + // QueryNode defines a method to query and stream hardware state of the cluster + // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + QueryCluster(*VoidNoParam, ClusterRPC_QueryClusterServer) error +} + +// UnimplementedClusterRPCServer can be embedded to have forward compatible implementations. +type UnimplementedClusterRPCServer struct { +} + +func (*UnimplementedClusterRPCServer) QueryCluster(req *VoidNoParam, srv ClusterRPC_QueryClusterServer) error { + return status.Errorf(codes.Unimplemented, "method QueryCluster not implemented") +} + +func RegisterClusterRPCServer(s grpc1.Server, srv ClusterRPCServer) { + s.RegisterService(&_ClusterRPC_serviceDesc, srv) +} + +func _ClusterRPC_QueryCluster_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(VoidNoParam) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ClusterRPCServer).QueryCluster(m, &clusterRPCQueryClusterServer{stream}) +} + +type ClusterRPC_QueryClusterServer interface { + Send(*Cluster) error + grpc.ServerStream +} + +type clusterRPCQueryClusterServer struct { + grpc.ServerStream +} + +func (x *clusterRPCQueryClusterServer) Send(m *Cluster) error { + return x.ServerStream.SendMsg(m) +} + +var _ClusterRPC_serviceDesc = grpc.ServiceDesc{ + ServiceName: "akash.inventory.v1.ClusterRPC", + HandlerType: (*ClusterRPCServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "QueryCluster", + Handler: _ClusterRPC_QueryCluster_Handler, ServerStreams: true, }, }, @@ -267,10 +379,10 @@ func (m *VoidNoParam) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: voidNoParam: wiretype end group for non-group") + return fmt.Errorf("proto: VoidNoParam: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: voidNoParam: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: VoidNoParam: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/go/inventory/v1/storage.go b/go/inventory/v1/storage.go new file mode 100644 index 00000000..6309c34a --- /dev/null +++ b/go/inventory/v1/storage.go @@ -0,0 +1,29 @@ +package v1 + +func (s ClusterStorage) Dup() ClusterStorage { + res := make(ClusterStorage, 0, len(s)) + + for _, storage := range s { + res = append(res, Storage{ + Quantity: storage.Quantity.Dup(), + Info: storage.Info.Dup(), + }) + } + return res +} + +func (r *Storage) Dup() Storage { + res := Storage{ + Quantity: r.Quantity.Dup(), + Info: r.Info.Dup(), + } + + return res +} + +func (s *StorageInfo) Dup() StorageInfo { + return StorageInfo{ + Class: s.Class, + IOPS: s.IOPS, + } +} diff --git a/go/inventory/v1/storage.pb.go b/go/inventory/v1/storage.pb.go index ceb73cee..bab6d6d1 100644 --- a/go/inventory/v1/storage.pb.go +++ b/go/inventory/v1/storage.pb.go @@ -6,7 +6,7 @@ package v1 import ( fmt "fmt" _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/golang/protobuf/proto" + proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" @@ -21,11 +21,12 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// StorageInfo reports Storage details type StorageInfo struct { Class string `protobuf:"bytes,1,opt,name=class,proto3" json:"class" yaml:"class"` - IOPS string `protobuf:"bytes,2,opt,name=IOPS,proto3" json:"iops" yaml:"iops"` + IOPS string `protobuf:"bytes,2,opt,name=iops,proto3" json:"iops" yaml:"iops"` } func (m *StorageInfo) Reset() { *m = StorageInfo{} } @@ -75,6 +76,7 @@ func (m *StorageInfo) GetIOPS() string { return "" } +// Storage reports Storage inventory details type Storage struct { Quantity ResourcePair `protobuf:"bytes,1,opt,name=quantity,proto3" json:"quantity" yaml:"quantity"` Info StorageInfo `protobuf:"bytes,2,opt,name=info,proto3" json:"info" yaml:"info"` @@ -135,30 +137,30 @@ func init() { func init() { proto.RegisterFile("akash/inventory/v1/storage.proto", fileDescriptor_98ef685b221b1af7) } var fileDescriptor_98ef685b221b1af7 = []byte{ - // 354 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x51, 0xbf, 0x4e, 0xc2, 0x40, - 0x1c, 0x6e, 0x4d, 0x51, 0x6c, 0x4d, 0x4c, 0x1a, 0x07, 0xc2, 0xd0, 0x23, 0x67, 0x4c, 0x5c, 0x6c, - 0x03, 0x2c, 0xc6, 0xb1, 0x4e, 0x4c, 0x62, 0x59, 0x8c, 0xdb, 0x41, 0xda, 0x72, 0x01, 0xee, 0x57, - 0xaf, 0x05, 0x43, 0xe2, 0x43, 0x38, 0xfa, 0x48, 0x8c, 0xc4, 0xc9, 0xe9, 0x62, 0xda, 0x8d, 0x91, - 0x27, 0x30, 0xbd, 0xab, 0x04, 0x23, 0x5b, 0xbf, 0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x3f, - 0x99, 0x06, 0x65, 0x11, 0xc8, 0xff, 0xb5, 0x3a, 0xe8, 0x50, 0xd5, 0xde, 0xc5, 0xf8, 0x97, 0x55, - 0x93, 0x51, 0x22, 0x39, 0x8a, 0x45, 0xb0, 0x37, 0x8a, 0x45, 0x80, 0x03, 0x49, 0xfa, 0xfd, 0x55, - 0xee, 0xe8, 0xeb, 0xdc, 0xd1, 0xbf, 0x73, 0x47, 0x7f, 0x2f, 0x1c, 0xed, 0xa3, 0x70, 0xb4, 0x75, - 0xe1, 0x68, 0x5f, 0x85, 0xa3, 0x3d, 0x77, 0x62, 0x9a, 0x8d, 0xe7, 0x43, 0x77, 0x04, 0x33, 0x4f, - 0x76, 0xde, 0xb0, 0x30, 0x7b, 0x05, 0x3e, 0xa9, 0x10, 0x49, 0xa8, 0x17, 0xc3, 0x9f, 0x77, 0x1b, - 0x1e, 0xcb, 0xb7, 0xea, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0xad, 0xe9, 0xbb, 0xb5, 0x20, 0x02, - 0x00, 0x00, + // 355 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x91, 0x31, 0x4f, 0xc2, 0x40, + 0x1c, 0xc5, 0x5b, 0x53, 0x14, 0x5b, 0x13, 0x93, 0xc6, 0x81, 0x30, 0xf4, 0x48, 0x8d, 0x89, 0x8b, + 0xbd, 0x00, 0x8b, 0x71, 0xc4, 0x89, 0xc4, 0x44, 0x2c, 0x8b, 0x71, 0x3b, 0x48, 0x5b, 0x2e, 0xc0, + 0xfd, 0xeb, 0xf5, 0xc0, 0x90, 0xf8, 0x21, 0xfc, 0x58, 0x8c, 0xc4, 0xc9, 0xe9, 0x62, 0xca, 0xc6, + 0xc8, 0x27, 0x30, 0xbd, 0xab, 0x04, 0x23, 0x5b, 0xdf, 0xfb, 0xbf, 0xff, 0xfd, 0xfa, 0xee, 0xec, + 0x06, 0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0, 0xfe, 0xd7, 0x69, 0xa1, 0x43, 0xa8, 0xbd, + 0x8b, 0xe9, 0x5c, 0x96, 0x24, 0xab, 0x50, 0xaa, 0x14, 0x8b, 0x61, 0xaf, 0x14, 0x8b, 0xa1, 0x28, + 0x55, 0x44, 0x1f, 0x96, 0xb9, 0x67, 0xae, 0x72, 0xcf, 0xfc, 0xce, 0x3d, 0xf3, 0x63, 0xed, 0x19, + 0xab, 0xb5, 0x67, 0x7c, 0xad, 0x3d, 0xe3, 0xa5, 0x95, 0x50, 0x31, 0x9a, 0x0d, 0x82, 0x21, 0x4c, + 0xb1, 0xe2, 0xdd, 0xb0, 0x48, 0xbc, 0x01, 0x1f, 0x97, 0x8a, 0xa4, 0x14, 0x27, 0xf0, 0xe7, 0xcd, + 0x06, 0xc7, 0xea, 0x9d, 0xda, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x05, 0x29, 0xcd, 0xfa, 0x1c, + 0x02, 0x00, 0x00, } func (m *StorageInfo) Marshal() (dAtA []byte, err error) { diff --git a/go/inventory/v1/types.go b/go/inventory/v1/types.go index 5718e8e7..4f79eee6 100644 --- a/go/inventory/v1/types.go +++ b/go/inventory/v1/types.go @@ -5,6 +5,10 @@ import ( ) type CPUInfoS []CPUInfo +type GPUInfoS []GPUInfo + +type MemoryInfoS []MemoryInfo + type GPUs []GPU type Nodes []Node @@ -55,29 +59,29 @@ func (s GPUs) Less(i, j int) bool { return a.Quantity.LT(b.Quantity) } - if a.Info.Vendor != b.Info.Vendor { - return a.Info.Vendor < b.Info.Vendor - } - - if a.Info.Vendor != b.Info.Vendor { - return a.Info.Vendor < b.Info.Vendor - } - - if a.Info.Name != b.Info.Name { - return a.Info.Name < b.Info.Name - } - - if a.Info.ModelID != b.Info.ModelID { - return a.Info.ModelID < b.Info.ModelID - } - - if a.Info.Interface != b.Info.Interface { - return a.Info.Interface < b.Info.Interface - } - - if a.Info.MemorySize != b.Info.MemorySize { - return a.Info.MemorySize < b.Info.MemorySize - } + // if a.Info.Vendor != b.Info.Vendor { + // return a.Info.Vendor < b.Info.Vendor + // } + // + // if a.Info.Vendor != b.Info.Vendor { + // return a.Info.Vendor < b.Info.Vendor + // } + // + // if a.Info.Name != b.Info.Name { + // return a.Info.Name < b.Info.Name + // } + // + // if a.Info.ModelID != b.Info.ModelID { + // return a.Info.ModelID < b.Info.ModelID + // } + // + // if a.Info.Interface != b.Info.Interface { + // return a.Info.Interface < b.Info.Interface + // } + // + // if a.Info.MemorySize != b.Info.MemorySize { + // return a.Info.MemorySize < b.Info.MemorySize + // } return false } diff --git a/go/node/market/v1beta4/bid_test.go b/go/node/market/v1beta4/bid_test.go index a9ee578e..4f753904 100644 --- a/go/node/market/v1beta4/bid_test.go +++ b/go/node/market/v1beta4/bid_test.go @@ -34,7 +34,7 @@ func TestBid_GSpecMatch_InvalidCount(t *testing.T) { gspec := testutil.GroupSpec(t) if len(gspec.Resources) == 1 { - rl := testutil.ResourcesList(t, 2) + rl := testutil.ResourcesList(t, 1) gspec.Resources = append(gspec.Resources, rl...) } diff --git a/make/mod.mk b/make/mod.mk index b91d6654..1b5b42b1 100644 --- a/make/mod.mk +++ b/make/mod.mk @@ -38,3 +38,4 @@ modvendor: $(MODVENDOR) modsensure @echo "$${VENDOR_BUF}" > vendor/k8s.io/apimachinery/pkg/api/resource/buf.yaml @echo "$${VENDOR_BUF}" > vendor/github.com/cosmos/cosmos-sdk/proto/buf.yaml @echo "$${VENDOR_BUF}" > vendor/github.com/cosmos/cosmos-sdk/third_party/proto/buf.yaml + @ln -snf ../../vendor/k8s.io .cache/include/k8s.io diff --git a/proto/provider/akash/inventory/v1/cluster.proto b/proto/provider/akash/inventory/v1/cluster.proto index c271ce7a..7aca9c42 100644 --- a/proto/provider/akash/inventory/v1/cluster.proto +++ b/proto/provider/akash/inventory/v1/cluster.proto @@ -4,11 +4,11 @@ package akash.inventory.v1; import "gogoproto/gogo.proto"; import "akash/inventory/v1/node.proto"; -import "akash/inventory/v1/resourcepair.proto"; import "akash/inventory/v1/storage.proto"; option go_package = "github.com/akash-network/akash-api/go/inventory/v1"; +// Cluster reports inventory across entire cluster message Cluster { option (gogoproto.equal) = false; diff --git a/proto/provider/akash/inventory/v1/cpu.proto b/proto/provider/akash/inventory/v1/cpu.proto index 73e3e529..46c82234 100644 --- a/proto/provider/akash/inventory/v1/cpu.proto +++ b/proto/provider/akash/inventory/v1/cpu.proto @@ -6,8 +6,12 @@ import "gogoproto/gogo.proto"; import "akash/inventory/v1/resourcepair.proto"; option go_package = "github.com/akash-network/akash-api/go/inventory/v1"; -option (gogoproto.gogoproto_import) = false; +// leave it commented for now. having it as true used to cause issues with GRPC reflection. +// it seems to work for now +//option (gogoproto.gogoproto_import) = false; + +// CPUInfo reports CPU details message CPUInfo { string id = 1 [ (gogoproto.customname) = "ID", @@ -31,6 +35,7 @@ message CPUInfo { ]; } +// CPU reports CPU inventory details message CPU { ResourcePair quantity = 1 [ (gogoproto.nullable) = false, diff --git a/proto/provider/akash/inventory/v1/gpu.proto b/proto/provider/akash/inventory/v1/gpu.proto index cf8bd114..a314e4cf 100644 --- a/proto/provider/akash/inventory/v1/gpu.proto +++ b/proto/provider/akash/inventory/v1/gpu.proto @@ -3,12 +3,11 @@ syntax = "proto3"; package akash.inventory.v1; import "gogoproto/gogo.proto"; - import "akash/inventory/v1/resourcepair.proto"; option go_package = "github.com/akash-network/akash-api/go/inventory/v1"; -option (gogoproto.gogoproto_import) = false; +// GPUInfo reports GPU details message GPUInfo { string vendor = 1 [ (gogoproto.customname) = "Vendor", @@ -37,6 +36,7 @@ message GPUInfo { ]; } +// GPUInfo reports GPU inventory details message GPU { ResourcePair quantity = 1 [ (gogoproto.nullable) = false, @@ -44,8 +44,9 @@ message GPU { (gogoproto.jsontag) = "quantity", (gogoproto.moretags) = "yaml:\"quantity\"" ]; - GPUInfo info = 2 [ + repeated GPUInfo info = 2 [ (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "GPUInfoS", (gogoproto.customname) = "Info", (gogoproto.jsontag) = "info", (gogoproto.moretags) = "yaml:\"info\"" diff --git a/proto/provider/akash/inventory/v1/memory.proto b/proto/provider/akash/inventory/v1/memory.proto index 9b281b1d..02919aac 100644 --- a/proto/provider/akash/inventory/v1/memory.proto +++ b/proto/provider/akash/inventory/v1/memory.proto @@ -7,8 +7,8 @@ import "gogoproto/gogo.proto"; import "akash/inventory/v1/resourcepair.proto"; option go_package = "github.com/akash-network/akash-api/go/inventory/v1"; -option (gogoproto.gogoproto_import) = false; +// MemoryInfo reports Memory details message MemoryInfo { string vendor = 1 [ (gogoproto.customname) = "Vendor", @@ -32,6 +32,7 @@ message MemoryInfo { ]; } +// Memory reports Memory inventory details message Memory { ResourcePair quantity = 1 [ (gogoproto.nullable) = false, @@ -42,6 +43,7 @@ message Memory { repeated MemoryInfo info = 2 [ (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "MemoryInfoS", (gogoproto.customname) = "Info", (gogoproto.jsontag) = "info", (gogoproto.moretags) = "yaml:\"info\"" diff --git a/proto/provider/akash/inventory/v1/node.proto b/proto/provider/akash/inventory/v1/node.proto index 94ff9d64..9d5c6f82 100644 --- a/proto/provider/akash/inventory/v1/node.proto +++ b/proto/provider/akash/inventory/v1/node.proto @@ -7,9 +7,9 @@ import "akash/inventory/v1/gpu.proto"; import "akash/inventory/v1/storage.proto"; import "akash/inventory/v1/memory.proto"; - option go_package = "github.com/akash-network/akash-api/go/inventory/v1"; +// Node reports node inventory details message Node { CPU cpu = 1 [ (gogoproto.nullable) = false, @@ -25,19 +25,18 @@ message Node { (gogoproto.moretags) = "yaml:\"memory\"" ]; - repeated GPU gpu = 3 [ + GPU gpu = 3 [ (gogoproto.nullable) = false, (gogoproto.castrepeated) = "GPUs", - (gogoproto.customname) = "Gpus", - (gogoproto.jsontag) = "gpus", - (gogoproto.moretags) = "yaml:\"gpus\"" + (gogoproto.customname) = "GPU", + (gogoproto.jsontag) = "gpu", + (gogoproto.moretags) = "yaml:\"gpu\"" ]; - repeated Storage storage = 4 [ + Storage storage = 4 [ (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "ClusterStorage", - (gogoproto.customname) = "Storage", - (gogoproto.jsontag) = "storage", - (gogoproto.moretags) = "yaml:\"storage\"" + (gogoproto.customname) = "EphemeralStorage", + (gogoproto.jsontag) = "EphemeralStorage", + (gogoproto.moretags) = "yaml:\"EphemeralStorage\"" ]; } diff --git a/proto/provider/akash/inventory/v1/resourcepair.proto b/proto/provider/akash/inventory/v1/resourcepair.proto index 0404d213..14ee2191 100644 --- a/proto/provider/akash/inventory/v1/resourcepair.proto +++ b/proto/provider/akash/inventory/v1/resourcepair.proto @@ -7,25 +7,26 @@ import "gogoproto/gogo.proto"; import "k8s.io/apimachinery/pkg/api/resource/generated.proto"; option go_package = "github.com/akash-network/akash-api/go/inventory/v1"; -option (gogoproto.gogoproto_import) = false; +// ResourcePair to extents resource.Quantity to provide total and available units of the resource message ResourcePair { option (gogoproto.equal) = false; k8s.io.apimachinery.pkg.api.resource.Quantity allocatable = 1 [ - (gogoproto.nullable) = false, + (gogoproto.nullable) = true, (gogoproto.customname) = "Allocatable", (gogoproto.jsontag) = "allocatable", (gogoproto.moretags) = "yaml:\"allocatable\"" ]; k8s.io.apimachinery.pkg.api.resource.Quantity allocated = 2 [ - (gogoproto.nullable) = false, + (gogoproto.nullable) = true, (gogoproto.customname) = "Allocated", (gogoproto.jsontag) = "allocated", (gogoproto.moretags) = "yaml:\"allocated\"" ]; repeated akash.base.v1beta3.Attribute attributes = 3 [ - (gogoproto.nullable) = true, + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/akash-network/akash-api/go/node/types/v1beta3.Attributes", (gogoproto.jsontag) = "attributes,omitempty", (gogoproto.moretags) = "yaml:\"attributes,omitempty\"" ]; diff --git a/proto/provider/akash/inventory/v1/service.proto b/proto/provider/akash/inventory/v1/service.proto index 42658369..063bf17f 100644 --- a/proto/provider/akash/inventory/v1/service.proto +++ b/proto/provider/akash/inventory/v1/service.proto @@ -2,15 +2,25 @@ syntax = "proto3"; package akash.inventory.v1; import "akash/inventory/v1/node.proto"; - +import "akash/inventory/v1/cluster.proto"; option go_package = "github.com/akash-network/akash-api/go/inventory/v1"; -message voidNoParam {} +// voidNoParam dummy param for RPC services +message VoidNoParam {} -// Msg defines the deployment Msg service. -service Msg { - // QueryNode defines a method to query an Akash Provider worker node specs - rpc QueryNode(voidNoParam) returns (stream Node); +// NodeRPC defines the RPC server of node +service NodeRPC { + // QueryNode defines a method to query and stream hardware state of the node + // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + rpc QueryNode(VoidNoParam) returns (stream Node); +} -} \ No newline at end of file +// ClusterRPC defines the RPC server of cluster +service ClusterRPC { + // QueryNode defines a method to query and stream hardware state of the cluster + // buf:lint:ignore RPC_REQUEST_RESPONSE_UNIQUE + // buf:lint:ignore RPC_RESPONSE_STANDARD_NAME + rpc QueryCluster(VoidNoParam) returns (stream Cluster); +} diff --git a/proto/provider/akash/inventory/v1/storage.proto b/proto/provider/akash/inventory/v1/storage.proto index 2ab086e2..911c016b 100644 --- a/proto/provider/akash/inventory/v1/storage.proto +++ b/proto/provider/akash/inventory/v1/storage.proto @@ -7,32 +7,33 @@ import "gogoproto/gogo.proto"; import "akash/inventory/v1/resourcepair.proto"; option go_package = "github.com/akash-network/akash-api/go/inventory/v1"; -option (gogoproto.gogoproto_import) = false; +// StorageInfo reports Storage details message StorageInfo { string class = 1 [ (gogoproto.customname) = "Class", (gogoproto.jsontag) = "class", (gogoproto.moretags) = "yaml:\"class\"" ]; - string IOPS = 2 [ + string iops = 2 [ (gogoproto.customname) = "IOPS", (gogoproto.jsontag) = "iops", (gogoproto.moretags) = "yaml:\"iops\"" ]; } - message Storage { - ResourcePair quantity = 1 [ - (gogoproto.nullable) = false, - (gogoproto.customname) = "Quantity", - (gogoproto.jsontag) = "quantity", - (gogoproto.moretags) = "yaml:\"quantity\"" - ]; - StorageInfo info = 2 [ - (gogoproto.nullable) = false, - (gogoproto.customname) = "Info", - (gogoproto.jsontag) = "info", - (gogoproto.moretags) = "yaml:\"info\"" - ]; - } +// Storage reports Storage inventory details +message Storage { + ResourcePair quantity = 1 [ + (gogoproto.nullable) = false, + (gogoproto.customname) = "Quantity", + (gogoproto.jsontag) = "quantity", + (gogoproto.moretags) = "yaml:\"quantity\"" + ]; + StorageInfo info = 2 [ + (gogoproto.nullable) = false, + (gogoproto.customname) = "Info", + (gogoproto.jsontag) = "info", + (gogoproto.moretags) = "yaml:\"info\"" + ]; +} diff --git a/proto/provider/buf.yaml b/proto/provider/buf.yaml index 51286dfb..3c1f7e5b 100644 --- a/proto/provider/buf.yaml +++ b/proto/provider/buf.yaml @@ -1,6 +1,6 @@ # This module represents buf.build/akash-network/manifest version: v1 -name: buf.build/akash-network/manifest +name: buf.build/akash-network/provider deps: - buf.build/akash-network/node # - buf.build/cosmos/cosmos-proto