|
|
|
@@ -19,7 +19,7 @@ const ( |
|
|
|
) |
|
|
|
|
|
|
|
type SlwNode struct { |
|
|
|
ID schsdk.SlwNodeID `json:"ID"` |
|
|
|
ID schsdk.SlwNodeID `json:"id"` |
|
|
|
Name string `json:"name"` |
|
|
|
SlwRegionID int64 `json:"slwRegionID"` |
|
|
|
StgNodeID int64 `json:"stgNodeID"` |
|
|
|
@@ -45,19 +45,19 @@ type ResourceDataBase struct{} |
|
|
|
|
|
|
|
func (d *ResourceDataBase) Noop() {} |
|
|
|
|
|
|
|
type DetailType[T any] struct { |
|
|
|
type UnitValue[T any] struct { |
|
|
|
Unit string `json:"unit"` |
|
|
|
Value T `json:"value"` |
|
|
|
} |
|
|
|
|
|
|
|
type CPUResourceData struct { |
|
|
|
ResourceDataBase |
|
|
|
Name ResourceType `json:"name" union:"CPU"` |
|
|
|
Total DetailType[int64] `json:"total"` |
|
|
|
Available DetailType[int64] `json:"available"` |
|
|
|
Name ResourceType `json:"name" union:"CPU"` |
|
|
|
Total UnitValue[int64] `json:"total"` |
|
|
|
Available UnitValue[int64] `json:"available"` |
|
|
|
} |
|
|
|
|
|
|
|
func NewCPUResourceData(total DetailType[int64], available DetailType[int64]) *CPUResourceData { |
|
|
|
func NewCPUResourceData(total UnitValue[int64], available UnitValue[int64]) *CPUResourceData { |
|
|
|
return &CPUResourceData{ |
|
|
|
Name: ResourceTypeCPU, |
|
|
|
Total: total, |
|
|
|
@@ -67,12 +67,12 @@ func NewCPUResourceData(total DetailType[int64], available DetailType[int64]) *C |
|
|
|
|
|
|
|
type NPUResourceData struct { |
|
|
|
ResourceDataBase |
|
|
|
Name ResourceType `json:"name" union:"NPU"` |
|
|
|
Total DetailType[int64] `json:"total"` |
|
|
|
Available DetailType[int64] `json:"available"` |
|
|
|
Name ResourceType `json:"name" union:"NPU"` |
|
|
|
Total UnitValue[int64] `json:"total"` |
|
|
|
Available UnitValue[int64] `json:"available"` |
|
|
|
} |
|
|
|
|
|
|
|
func NewNPUResourceData(total DetailType[int64], available DetailType[int64]) *NPUResourceData { |
|
|
|
func NewNPUResourceData(total UnitValue[int64], available UnitValue[int64]) *NPUResourceData { |
|
|
|
return &NPUResourceData{ |
|
|
|
Name: ResourceTypeNPU, |
|
|
|
Total: total, |
|
|
|
@@ -82,12 +82,12 @@ func NewNPUResourceData(total DetailType[int64], available DetailType[int64]) *N |
|
|
|
|
|
|
|
type GPUResourceData struct { |
|
|
|
ResourceDataBase |
|
|
|
Name ResourceType `json:"name" union:"GPU"` |
|
|
|
Total DetailType[int64] `json:"total"` |
|
|
|
Available DetailType[int64] `json:"available"` |
|
|
|
Name ResourceType `json:"name" union:"GPU"` |
|
|
|
Total UnitValue[int64] `json:"total"` |
|
|
|
Available UnitValue[int64] `json:"available"` |
|
|
|
} |
|
|
|
|
|
|
|
func NewGPUResourceData(total DetailType[int64], available DetailType[int64]) *GPUResourceData { |
|
|
|
func NewGPUResourceData(total UnitValue[int64], available UnitValue[int64]) *GPUResourceData { |
|
|
|
return &GPUResourceData{ |
|
|
|
Name: ResourceTypeGPU, |
|
|
|
Total: total, |
|
|
|
@@ -97,12 +97,12 @@ func NewGPUResourceData(total DetailType[int64], available DetailType[int64]) *G |
|
|
|
|
|
|
|
type MLUResourceData struct { |
|
|
|
ResourceDataBase |
|
|
|
Name ResourceType `json:"name" union:"MLU"` |
|
|
|
Total DetailType[int64] `json:"total"` |
|
|
|
Available DetailType[int64] `json:"available"` |
|
|
|
Name ResourceType `json:"name" union:"MLU"` |
|
|
|
Total UnitValue[int64] `json:"total"` |
|
|
|
Available UnitValue[int64] `json:"available"` |
|
|
|
} |
|
|
|
|
|
|
|
func NewMLUResourceData(total DetailType[int64], available DetailType[int64]) *MLUResourceData { |
|
|
|
func NewMLUResourceData(total UnitValue[int64], available UnitValue[int64]) *MLUResourceData { |
|
|
|
return &MLUResourceData{ |
|
|
|
Name: ResourceTypeMLU, |
|
|
|
Total: total, |
|
|
|
@@ -112,12 +112,12 @@ func NewMLUResourceData(total DetailType[int64], available DetailType[int64]) *M |
|
|
|
|
|
|
|
type StorageResourceData struct { |
|
|
|
ResourceDataBase |
|
|
|
Name ResourceType `json:"name" union:"STORAGE"` |
|
|
|
Total DetailType[float64] `json:"total"` |
|
|
|
Available DetailType[float64] `json:"available"` |
|
|
|
Name ResourceType `json:"name" union:"STORAGE"` |
|
|
|
Total UnitValue[float64] `json:"total"` |
|
|
|
Available UnitValue[float64] `json:"available"` |
|
|
|
} |
|
|
|
|
|
|
|
func NewStorageResourceData(total DetailType[float64], available DetailType[float64]) *StorageResourceData { |
|
|
|
func NewStorageResourceData(total UnitValue[float64], available UnitValue[float64]) *StorageResourceData { |
|
|
|
return &StorageResourceData{ |
|
|
|
Name: ResourceTypeStorage, |
|
|
|
Total: total, |
|
|
|
@@ -127,12 +127,12 @@ func NewStorageResourceData(total DetailType[float64], available DetailType[floa |
|
|
|
|
|
|
|
type MemoryResourceData struct { |
|
|
|
ResourceDataBase |
|
|
|
Name ResourceType `json:"name" union:"MEMORY"` |
|
|
|
Total DetailType[float64] `json:"total"` |
|
|
|
Available DetailType[float64] `json:"available"` |
|
|
|
Name ResourceType `json:"name" union:"MEMORY"` |
|
|
|
Total UnitValue[float64] `json:"total"` |
|
|
|
Available UnitValue[float64] `json:"available"` |
|
|
|
} |
|
|
|
|
|
|
|
func NewMemoryResourceData(total DetailType[float64], available DetailType[float64]) *MemoryResourceData { |
|
|
|
func NewMemoryResourceData(total UnitValue[float64], available UnitValue[float64]) *MemoryResourceData { |
|
|
|
return &MemoryResourceData{ |
|
|
|
Name: ResourceTypeMemory, |
|
|
|
Total: total, |
|
|
|
|