github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/fs/api.go (about) 1 // Package fs provides mountpath and FQN abstractions and methods to resolve/map stored content 2 /* 3 * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. 4 */ 5 package fs 6 7 import ( 8 "github.com/NVIDIA/aistore/cmn/cos" 9 "github.com/NVIDIA/aistore/ios" 10 ) 11 12 type ( 13 Capacity struct { 14 Used uint64 `json:"used,string"` // bytes 15 Avail uint64 `json:"avail,string"` // ditto 16 PctUsed int32 `json:"pct_used"` // %% used (redundant ok) 17 } 18 // Capacity, Disks, Filesystem (CDF) 19 CDF struct { 20 Capacity 21 Disks []string `json:"disks"` // owned or shared disks (ios.FsDisks map => slice) 22 Label ios.Label `json:"mountpath_label"` 23 FS cos.FS `json:"fs"` 24 } 25 // Target (cumulative) CDF 26 TargetCDF struct { 27 Mountpaths map[string]*CDF // mpath => [Capacity, Disks, FS (CDF)] 28 TotalUsed uint64 `json:"total_used,string"` // bytes 29 TotalAvail uint64 `json:"total_avail,string"` // bytes 30 PctMax int32 `json:"pct_max"` // max used (%) 31 PctAvg int32 `json:"pct_avg"` // avg used (%) 32 PctMin int32 `json:"pct_min"` // min used (%) 33 CsErr string `json:"cs_err"` // OOS or high-wm error message 34 } 35 ) 36 37 // [backward compatibility]: v3.22 cdf* structures 38 type ( 39 CDFv322 struct { 40 Capacity 41 Disks []string `json:"disks"` 42 FS string `json:"fs"` 43 } 44 TargetCDFv322 struct { 45 Mountpaths map[string]*CDFv322 46 PctMax int32 `json:"pct_max"` 47 PctAvg int32 `json:"pct_avg"` 48 PctMin int32 `json:"pct_min"` 49 CsErr string `json:"cs_err"` 50 } 51 ) 52 53 func InitCDF(tcdf *TargetCDF) { 54 avail := GetAvail() 55 tcdf.Mountpaths = make(map[string]*CDF, len(avail)) 56 for mpath := range avail { 57 tcdf.Mountpaths[mpath] = &CDF{} 58 } 59 }