ErrorIndex StatType = 4
NameVector StatType = 5
Empty StatType = 6
+ Symlink StatType = 7
)
func (d StatType) String() string {
return "NameVector"
case Empty:
return "Empty"
+ case Symlink:
+ return "Symlink"
}
return fmt.Sprintf("UnknownStatType(%d)", d)
}
// is defined by Type.
type StatEntry struct {
StatIdentifier
- Type StatType
- Data Stat
+ Type StatType
+ Data Stat
+ Symlink bool
}
// Counter represents simple counter with single value, which is usually packet count.
// IsZero returns true if all of its values equal to zero.
IsZero() bool
+ // Type returns underlying type of a stat
+ Type() StatType
+
// isStat is intentionally unexported to limit implementations of interface to this package,
isStat()
}
// ErrorStat represents stat for ErrorIndex. The array represents workers.
type ErrorStat []Counter
-// SimpleCounterStat represents stat for SimpleCounterVector.
+// SimpleCounterStat represents indexed stat for SimpleCounterVector.
// The outer array represents workers and the inner array represents interface/node/.. indexes.
// Values should be aggregated per interface/node for every worker.
// ReduceSimpleCounterStatIndex can be used to reduce specific index.
type SimpleCounterStat [][]Counter
-// CombinedCounterStat represents stat for CombinedCounterVector.
+// CombinedCounterStat represents indexed stat for CombinedCounterVector.
// The outer array represents workers and the inner array represents interface/node/.. indexes.
// Values should be aggregated per interface/node for every worker.
// ReduceCombinedCounterStatIndex can be used to reduce specific index.
func (s ScalarStat) IsZero() bool {
return s == 0
}
+
+func (s ScalarStat) Type() StatType {
+ return ScalarIndex
+}
+
func (s ErrorStat) IsZero() bool {
if s == nil {
return true
}
return true
}
+
+func (s ErrorStat) Type() StatType {
+ return ErrorIndex
+}
+
func (s SimpleCounterStat) IsZero() bool {
if s == nil {
return true
}
return true
}
+
+func (s SimpleCounterStat) Type() StatType {
+ return SimpleCounterVector
+}
+
func (s CombinedCounterStat) IsZero() bool {
if s == nil {
return true
}
return true
}
+
+func (s CombinedCounterStat) Type() StatType {
+ return CombinedCounterVector
+}
+
func (s NameStat) IsZero() bool {
if s == nil {
return true
}
return true
}
+
+func (s NameStat) Type() StatType {
+ return NameVector
+}
+
func (s EmptyStat) IsZero() bool {
return true
}
+func (s EmptyStat) Type() StatType {
+ return Empty
+}
+
// ReduceSimpleCounterStatIndex returns reduced SimpleCounterStat s for index i.
func ReduceSimpleCounterStatIndex(s SimpleCounterStat, i int) uint64 {
var val uint64