Sfoglia il codice sorgente

Add a `DstStats` type to track Destination (real server) stats

Since SvcStats represents the stats for a `Service`, we don't want
to reuse that struct in the `Destination` (for no other reason than
incompatible nomenclature). So this patch adds a `DstStats` struct
to hold the Destination stats.
Akshay 6 anni fa
parent
commit
0922883b7e
2 ha cambiato i file con 5 aggiunte e 2 eliminazioni
  1. 4 1
      libnetwork/ipvs/ipvs.go
  2. 1 1
      libnetwork/ipvs/netlink.go

+ 4 - 1
libnetwork/ipvs/ipvs.go

@@ -62,9 +62,12 @@ type Destination struct {
 	LowerThreshold      uint32
 	LowerThreshold      uint32
 	ActiveConnections   int
 	ActiveConnections   int
 	InactiveConnections int
 	InactiveConnections int
-	Stats               SvcStats
+	Stats               DstStats
 }
 }
 
 
+// DstStats defines IPVS destination (real server) statistics
+type DstStats SvcStats
+
 // Handle provides a namespace specific ipvs handle to program ipvs
 // Handle provides a namespace specific ipvs handle to program ipvs
 // rules.
 // rules.
 type Handle struct {
 type Handle struct {

+ 1 - 1
libnetwork/ipvs/netlink.go

@@ -448,7 +448,7 @@ func assembleDestination(attrs []syscall.NetlinkRouteAttr) (*Destination, error)
 			if err != nil {
 			if err != nil {
 				return nil, err
 				return nil, err
 			}
 			}
-			d.Stats = stats
+			d.Stats = DstStats(stats)
 		}
 		}
 	}
 	}
 	return &d, nil
 	return &d, nil