Do not to handle empty stats directory as unknown.
Empty dir's value is always treated as zero.
Change-Id: I40a3829675c5b7c9da80ceaa7e2d0a87fe02dc7c
Signed-off-by: Vladimir Lavor <vlavor@cisco.com>
CombinedCounterVector StatType = 3
ErrorIndex StatType = 4
NameVector StatType = 5
CombinedCounterVector StatType = 3
ErrorIndex StatType = 4
NameVector StatType = 5
)
func (d StatType) String() string {
)
func (d StatType) String() string {
return "ErrorIndex"
case NameVector:
return "NameVector"
return "ErrorIndex"
case NameVector:
return "NameVector"
+ case Empty:
+ return "Empty"
}
return fmt.Sprintf("UnknownStatType(%d)", d)
}
}
return fmt.Sprintf("UnknownStatType(%d)", d)
}
// NameStat represents stat for NameVector.
type NameStat []Name
// NameStat represents stat for NameVector.
type NameStat []Name
+// EmptyStat represents removed counter directory
+type EmptyStat string
+
func (ScalarStat) isStat() {}
func (ErrorStat) isStat() {}
func (SimpleCounterStat) isStat() {}
func (CombinedCounterStat) isStat() {}
func (NameStat) isStat() {}
func (ScalarStat) isStat() {}
func (ErrorStat) isStat() {}
func (SimpleCounterStat) isStat() {}
func (CombinedCounterStat) isStat() {}
func (NameStat) isStat() {}
+func (EmptyStat) isStat() {}
func (s ScalarStat) IsZero() bool {
return s == 0
func (s ScalarStat) IsZero() bool {
return s == 0
+func (s EmptyStat) IsZero() bool {
+ return true
+}
// ReduceSimpleCounterStatIndex returns reduced SimpleCounterStat s for index i.
func ReduceSimpleCounterStatIndex(s SimpleCounterStat, i int) uint64 {
// ReduceSimpleCounterStatIndex returns reduced SimpleCounterStat s for index i.
func ReduceSimpleCounterStatIndex(s SimpleCounterStat, i int) uint64 {
return adapter.NameStat(data)
case statDirEmpty:
return adapter.NameStat(data)
case statDirEmpty:
+ return adapter.EmptyStat("<none>")