diff --git a/go/inventory/v1/cluster.go b/go/inventory/v1/cluster.go new file mode 100644 index 00000000..4efbadee --- /dev/null +++ b/go/inventory/v1/cluster.go @@ -0,0 +1,10 @@ +package v1 + +func (cl *Cluster) Dup() *Cluster { + res := &Cluster{ + Nodes: nil, + Storage: nil, + } + + return res +} 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..177e9837 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,7 +21,7 @@ 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 type CPUInfo struct { ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" yaml:"id"` @@ -93,7 +93,7 @@ func (m *CPUInfo) GetVcores() uint32 { 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 +136,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 +151,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, - 0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8, 0x23, 0x8d, 0xfc, 0xeb, 0xd0, 0x70, 0x17, 0x3a, 0x1f, 0xf1, - 0x98, 0xf1, 0xb5, 0x70, 0xed, 0xd9, 0x68, 0x3e, 0x5d, 0x3c, 0xbd, 0x0f, 0x65, 0x2e, 0x61, 0xf9, - 0xdc, 0x50, 0xc6, 0x83, 0xea, 0x14, 0x81, 0x62, 0xaf, 0xc8, 0xd4, 0x5c, 0x00, 0x5f, 0x0b, 0x1a, - 0x82, 0xb9, 0x5c, 0xdd, 0x34, 0x1e, 0xba, 0x6d, 0x3c, 0xf4, 0xab, 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, + 0x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0xf5, 0x46, 0x64, 0x7c, 0x60, 0x8b, 0x91, 0xc1, 0x62, 0x9c, + 0xfe, 0x29, 0x46, 0xdc, 0x14, 0x9b, 0xe1, 0x3b, 0xa1, 0xdd, 0x93, 0xd9, 0x99, 0xbb, 0xa2, 0x83, + 0xcf, 0x79, 0x2c, 0x32, 0x9e, 0x6d, 0xf1, 0xc2, 0xc3, 0xc9, 0x28, 0xb8, 0xfd, 0xb4, 0x41, 0x64, + 0x1f, 0x6c, 0x16, 0x73, 0x35, 0x0d, 0xaf, 0x35, 0x74, 0x4a, 0x0d, 0x83, 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..4a50a097 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,7 +21,7 @@ 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 type GPUInfo struct { Vendor string `protobuf:"bytes,1,opt,name=vendor,proto3" json:"vendor" yaml:"vendor"` @@ -101,7 +101,7 @@ func (m *GPUInfo) GetMemorySize() string { 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 +144,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 +159,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,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ped 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, 0xa0, 0x95, 0xb8, 0xb5, 0x1e, 0xbc, 0xd4, 0x69, + 0x32, 0xd9, 0x0e, 0xed, 0xee, 0xc4, 0xc9, 0x26, 0x92, 0xfe, 0x0a, 0x7f, 0x87, 0xbf, 0xa4, 0xc7, + 0x9e, 0xc4, 0xd3, 0x28, 0x9b, 0x83, 0x90, 0xe3, 0xfe, 0x02, 0x99, 0xd9, 0x2f, 0xc5, 0xde, 0xf6, + 0x7d, 0xbe, 0xde, 0xe5, 0x7d, 0x06, 0xbd, 0xa0, 0xd7, 0x74, 0x79, 0xe5, 0xf1, 0x68, 0xcd, 0xa2, + 0x58, 0xc8, 0x8d, 0xb7, 0x3e, 0xf4, 0x82, 0xc5, 0xca, 0x5d, 0x48, 0x11, 0x0b, 0x8c, 0x0d, 0xeb, + 0x96, 0xac, 0xbb, 0x3e, 0xdc, 0x7b, 0x16, 0x88, 0x40, 0x18, 0xda, 0xd3, 0x5f, 0x99, 0x72, 0x6f, + 0xff, 0x81, 0x1c, 0xc9, 0x96, 0x62, 0x25, 0xa7, 0x6c, 0x41, 0xb9, 0xcc, 0x64, 0xe4, 0x77, 0x1d, + 0xb5, 0x8f, 0x27, 0xe7, 0xe3, 0x68, 0x2e, 0xf0, 0x1b, 0xd4, 0x5a, 0xb3, 0x68, 0x26, 0xa4, 0x6d, + 0xf5, 0xad, 0x83, 0xee, 0x68, 0x3f, 0x51, 0xd0, 0xfa, 0x60, 0x90, 0x9d, 0x82, 0x9c, 0x4b, 0x15, + 0x3c, 0xde, 0xd0, 0xf0, 0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, 0xea, 0x32, 0x05, 0x42, 0xfc, + 0x92, 0xc4, 0x9f, 0x50, 0x93, 0x47, 0x73, 0x61, 0xd7, 0xfb, 0x8d, 0x83, 0xde, 0xe0, 0xf9, 0x43, + 0xab, 0xf2, 0xfe, 0xcb, 0x2d, 0x4d, 0x3d, 0xe9, 0xda, 0xb4, 0xb1, 0xaa, 0x4d, 0x4f, 0xe4, 0xdb, + 0x4f, 0xe8, 0xe4, 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 +270,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 +345,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 +661,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..fec87de8 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,7 +21,7 @@ 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 type MemoryInfo struct { Vendor string `protobuf:"bytes,1,opt,name=vendor,proto3" json:"vendor" yaml:"vendor"` @@ -93,7 +93,7 @@ func (m *MemoryInfo) GetSpeed() string { 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 +136,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 +151,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, 0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, 0x21, 0xc2, 0x43, 0x5a, 0x04, 0x9a, 0x2e, 0x63, 0xd4, 0x0f, 0x6b, 0xe0, 0x12, 0xed, 0x7c, - 0x9d, 0xb3, 0x4a, 0x0b, 0xdd, 0xf8, 0x2d, 0x86, 0xe3, 0x51, 0xf6, 0xff, 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,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 0xb7, 0x89, 0x83, 0x1f, 0x9b, 0xb8, + 0x77, 0xbb, 0x89, 0x7b, 0xbf, 0x36, 0x71, 0xef, 0xf3, 0x64, 0xc1, 0xd5, 0xc5, 0xea, 0x34, 0x39, + 0x13, 0x79, 0xea, 0xda, 0x9f, 0x17, 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..2da13741 100644 --- a/go/inventory/v1/node.pb.go +++ b/go/inventory/v1/node.pb.go @@ -24,10 +24,10 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 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 +77,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 +98,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, 0x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 0x68, 0xa7, 0x9c, 0xeb, - 0x5b, 0xa0, 0xce, 0x83, 0xa8, 0x0c, 0x3b, 0xa0, 0x4e, 0xb4, 0xa1, 0xf8, 0x7d, 0x86, 0xca, 0xd8, - 0x6f, 0xfa, 0xd8, 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, 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0xce, 0x55, 0xe9, 0x77, 0x57, 0xc7, 0xf5, 0xed, 0xd6, 0xd6, 0xd5, 0x61, 0xae, 0xf0, 0xb3, 0x2b, + 0xc4, 0xb9, 0xf1, 0xf2, 0x06, 0x6a, 0x8e, 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 +145,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 +209,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 +319,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 +346,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 +379,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..dcad777e 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,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 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 +65,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 +95,34 @@ func init() { } var fileDescriptor_995cee7bf7b692e7 = []byte{ - // 407 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0xbd, 0xae, 0xd3, 0x30, - 0x18, 0x8d, 0x29, 0x42, 0xba, 0x09, 0x03, 0x8a, 0xee, 0x50, 0x5d, 0x44, 0x7c, 0x15, 0x09, 0xe9, - 0x0e, 0x60, 0xab, 0x29, 0x43, 0x55, 0xa6, 0xf6, 0x09, 0x4a, 0x46, 0x36, 0x27, 0xb5, 0x52, 0x2b, - 0x3f, 0x8e, 0x1c, 0x27, 0x28, 0x4c, 0xcc, 0x4c, 0x8c, 0x8c, 0x7d, 0x9c, 0x8e, 0x1d, 0x99, 0x2c, - 0x94, 0x2c, 0xa8, 0x63, 0x9f, 0x00, 0xe5, 0xa7, 0x4d, 0x2a, 0x31, 0xb1, 0xf9, 0x3b, 0xdf, 0x39, - 0xe7, 0x3b, 0xca, 0x89, 0xfe, 0x96, 0x84, 0x24, 0xdb, 0x61, 0x96, 0x14, 0x34, 0x91, 0x5c, 0x94, - 0xb8, 0x98, 0x61, 0x41, 0x33, 0x9e, 0x0b, 0x9f, 0xa6, 0x84, 0x09, 0x94, 0x0a, 0x2e, 0xb9, 0x69, - 0xb6, 0x34, 0x74, 0xa5, 0xa1, 0x62, 0xf6, 0x60, 0x77, 0x52, 0x8f, 0x64, 0x14, 0x17, 0x33, 0x8f, - 0x4a, 0x32, 0xc7, 0x44, 0x4a, 0xc1, 0xbc, 0x5c, 0xd2, 0x4e, 0xf7, 0x70, 0x1f, 0xf0, 0x80, 0xb7, - 0x4f, 0xdc, 0xbc, 0x7a, 0xf4, 0x43, 0xb8, 0xc8, 0x10, 0xe3, 0x98, 0xa4, 0x2c, 0x26, 0xfe, 0x8e, - 0x25, 0x54, 0x94, 0x38, 0x0d, 0x83, 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xca, 0x02, 0x3f, 0x6a, - 0x4b, 0xfb, 0x59, 0x5b, 0xda, 0xb1, 0xb6, 0xb4, 0x5f, 0xb5, 0xa5, 0x7d, 0x76, 0x02, 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, 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a, + 0x9a, 0xc8, 0xf2, 0x88, 0x5a, 0x7d, 0x40, 0x1b, 0x8d, 0x8d, 0xbd, 0xc6, 0xe7, 0x03, 0xf3, 0x99, + 0x48, 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 +159,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 +203,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 +284,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 +320,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 +356,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..bbbd4381 100644 --- a/go/inventory/v1/service.pb.go +++ b/go/inventory/v1/service.pb.go @@ -70,20 +70,22 @@ func init() { 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, + 0x65, 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, 0x0d, 0x29, 0x95, 0x59, 0x8f, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -94,28 +96,28 @@ 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 + 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 +127,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 +144,154 @@ 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 + 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 + 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 + 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, }, }, diff --git a/go/inventory/v1/storage.go b/go/inventory/v1/storage.go new file mode 100644 index 00000000..9095575a --- /dev/null +++ b/go/inventory/v1/storage.go @@ -0,0 +1,17 @@ +package v1 + +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..eac780a8 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,7 +21,7 @@ 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 type StorageInfo struct { Class string `protobuf:"bytes,1,opt,name=class,proto3" json:"class" yaml:"class"` @@ -135,30 +135,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, 0x7f, 0xf7, 0xf5, 0xbb, 0x33, 0x5b, 0x64, 0x42, - 0xd2, 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e8, 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, + // 353 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x51, 0x3f, 0x6b, 0xf2, 0x40, + 0x1c, 0x4e, 0x5e, 0xe2, 0xfb, 0xfa, 0x26, 0x85, 0x42, 0xe8, 0x20, 0x0e, 0x39, 0xb9, 0x52, 0xe8, + 0xd2, 0x04, 0x75, 0x29, 0x1d, 0xd3, 0x49, 0x28, 0xd4, 0xc6, 0xa5, 0x74, 0x3b, 0x25, 0x89, 0x87, + 0x7a, 0xbf, 0xf4, 0x72, 0x5a, 0x84, 0x7e, 0x88, 0x7e, 0x2c, 0x47, 0xe9, 0xd4, 0xe9, 0x28, 0x71, + 0x73, 0xf4, 0x13, 0x94, 0xdc, 0xa5, 0x62, 0xa9, 0x5b, 0x9e, 0x7f, 0xf7, 0xe4, 0xb9, 0xb3, 0x5b, + 0x64, 0x42, 0xf2, 0x71, 0x40, 0xd9, 0x22, 0x66, 0x02, 0xf8, 0x32, 0x58, 0xb4, 0x83, 0x5c, 0x00, + 0x27, 0x69, 0xec, 0x67, 0x1c, 0x04, 0xb8, 0xae, 0x72, 0xf8, 0x7b, 0x87, 0xbf, 0x68, 0x37, 0xcf, + 0x52, 0x48, 0x41, 0xc9, 0x41, 0xf9, 0xa5, 0x9d, 0xcd, 0x8b, 0x23, 0x67, 0xf1, 0x38, 0x87, 0x39, + 0x1f, 0xc5, 0x19, 0xa1, 0x5c, 0xdb, 0xf0, 0xab, 0xed, 0x0c, 0x74, 0x43, 0x8f, 0x25, 0xe0, 0x5e, + 0xdb, 0xb5, 0xd1, 0x94, 0xe4, 0x79, 0xc3, 0x6c, 0x99, 0x97, 0xff, 0x43, 0x5c, 0x48, 0x54, 0xbb, + 0x2d, 0x89, 0xad, 0x44, 0x5a, 0xd9, 0x49, 0x74, 0xb2, 0x24, 0xb3, 0xe9, 0x0d, 0x56, 0x10, 0x47, + 0x9a, 0x76, 0xbb, 0xb6, 0xd5, 0xbb, 0xef, 0x0f, 0x1a, 0x7f, 0x54, 0x10, 0x15, 0x12, 0x29, 0xbc, + 0x95, 0xc8, 0xa2, 0x90, 0x95, 0x31, 0x47, 0xc7, 0x4a, 0x84, 0x23, 0x25, 0xe2, 0x77, 0xd3, 0xfe, + 0x57, 0xd5, 0xbb, 0x33, 0xbb, 0xfe, 0x3c, 0x27, 0x4c, 0x50, 0xb1, 0x54, 0xed, 0x4e, 0xa7, 0xe5, + 0xff, 0x5e, 0xeb, 0x47, 0xd5, 0x86, 0x3e, 0xa1, 0x3c, 0x0c, 0x56, 0x12, 0x19, 0x85, 0x44, 0xf5, + 0x87, 0x2a, 0xb9, 0x95, 0x68, 0x7f, 0xca, 0x4e, 0xa2, 0x53, 0x5d, 0xf9, 0xcd, 0xe0, 0x68, 0x2f, + 0xba, 0x8f, 0xb6, 0x45, 0x59, 0x02, 0xea, 0x7f, 0x9d, 0x0e, 0x3a, 0x56, 0x75, 0x70, 0x31, 0xe1, + 0x79, 0xd5, 0x64, 0x95, 0x48, 0x8d, 0x62, 0x09, 0x1c, 0x8c, 0x62, 0x09, 0xe0, 0x48, 0x91, 0xe1, + 0xdd, 0xaa, 0xf0, 0xcc, 0x75, 0xe1, 0x99, 0x9f, 0x85, 0x67, 0xbe, 0x6d, 0x3c, 0x63, 0xbd, 0xf1, + 0x8c, 0x8f, 0x8d, 0x67, 0x3c, 0x75, 0x52, 0x2a, 0xc6, 0xf3, 0xa1, 0x3f, 0x82, 0x59, 0xa0, 0xfa, + 0xae, 0x58, 0x2c, 0x5e, 0x80, 0x4f, 0x2a, 0x44, 0x32, 0x1a, 0xa4, 0xf0, 0xe3, 0xcd, 0x86, 0x7f, + 0xd5, 0x3b, 0x75, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x81, 0x2f, 0xa5, 0x5c, 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/proto/provider/akash/inventory/v1/cpu.proto b/proto/provider/akash/inventory/v1/cpu.proto index 73e3e529..78888328 100644 --- a/proto/provider/akash/inventory/v1/cpu.proto +++ b/proto/provider/akash/inventory/v1/cpu.proto @@ -6,7 +6,10 @@ 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; message CPUInfo { string id = 1 [ diff --git a/proto/provider/akash/inventory/v1/gpu.proto b/proto/provider/akash/inventory/v1/gpu.proto index cf8bd114..4e045fe3 100644 --- a/proto/provider/akash/inventory/v1/gpu.proto +++ b/proto/provider/akash/inventory/v1/gpu.proto @@ -3,11 +3,9 @@ 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; message GPUInfo { string vendor = 1 [ @@ -44,8 +42,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..58e76770 100644 --- a/proto/provider/akash/inventory/v1/memory.proto +++ b/proto/provider/akash/inventory/v1/memory.proto @@ -7,7 +7,6 @@ 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; message MemoryInfo { string vendor = 1 [ @@ -42,6 +41,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..d46d9076 100644 --- a/proto/provider/akash/inventory/v1/node.proto +++ b/proto/provider/akash/inventory/v1/node.proto @@ -7,7 +7,6 @@ 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"; message Node { @@ -25,19 +24,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..17d77e0a 100644 --- a/proto/provider/akash/inventory/v1/resourcepair.proto +++ b/proto/provider/akash/inventory/v1/resourcepair.proto @@ -7,25 +7,25 @@ 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; 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..0f4f1979 100644 --- a/proto/provider/akash/inventory/v1/service.proto +++ b/proto/provider/akash/inventory/v1/service.proto @@ -2,15 +2,20 @@ 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 {} -// Msg defines the deployment Msg service. -service Msg { - // QueryNode defines a method to query an Akash Provider worker node specs +// NodeRPC defines the RPC server of node +service NodeRPC { + // QueryNode defines a method to query and stream hardware state of the node 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 + 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..74593236 100644 --- a/proto/provider/akash/inventory/v1/storage.proto +++ b/proto/provider/akash/inventory/v1/storage.proto @@ -7,7 +7,6 @@ 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; message StorageInfo { string class = 1 [