binapi-generator renamed & moved, finished documentation
[govpp.git] / api / ifcounters / doc.go
1 // Package ifcounters provides the helper API for decoding VnetInterfaceCounters binary API message
2 // that contains binary-encoded statistics data into the Go structs that are better consumable by the Go code.
3 //
4 // VPP provides two types of interface counters that can be encoded inside of a single VnetInterfaceCounters
5 // message: simple and combined. For both of them, ifcounters API provides a separate decode function:
6 // DecodeCounters or DecodeCombinedCounters. The functions return a slice of simple or combined counters respectively:
7 //
8 //      notifMsg := <-notifChan:
9 //      notif := notifMsg.(*interfaces.VnetInterfaceCounters)
10 //
11 //      if notif.IsCombined == 0 {
12 //              // simple counter
13 //              counters, err := ifcounters.DecodeCounters(ifcounters.VnetInterfaceCounters(*notif))
14 //              if err != nil {
15 //                      fmt.Println("Error:", err)
16 //              } else {
17 //                      fmt.Printf("%+v\n", counters)
18 //              }
19 //      } else {
20 //              // combined counter
21 //              counters, err := ifcounters.DecodeCombinedCounters(ifcounters.VnetInterfaceCounters(*notif))
22 //              if err != nil {
23 //                      fmt.Println("Error:", err)
24 //              } else {
25 //                      fmt.Printf("%+v\n", counters)
26 //              }
27 //      }
28 //
29 package ifcounters