Merge pull request #1578 from NickrenREN/sysfs-new
optimize NewRealSysFs()
This commit is contained in:
commit
fb28b0da1b
@ -117,10 +117,7 @@ func main() {
|
||||
glog.Fatalf("Failed to initialize storage driver: %s", err)
|
||||
}
|
||||
|
||||
sysFs, err := sysfs.NewRealSysFs()
|
||||
if err != nil {
|
||||
glog.Fatalf("Failed to create a system interface: %s", err)
|
||||
}
|
||||
sysFs := sysfs.NewRealSysFs()
|
||||
|
||||
collectorHttpClient := createCollectorHttpClient(*collectorCert, *collectorKey)
|
||||
|
||||
|
@ -70,8 +70,8 @@ type SysFs interface {
|
||||
|
||||
type realSysFs struct{}
|
||||
|
||||
func NewRealSysFs() (SysFs, error) {
|
||||
return &realSysFs{}, nil
|
||||
func NewRealSysFs() SysFs {
|
||||
return &realSysFs{}
|
||||
}
|
||||
|
||||
func (self *realSysFs) GetBlockDevices() ([]os.FileInfo, error) {
|
||||
|
@ -155,10 +155,7 @@ func GetCacheInfo(sysFs sysfs.SysFs, id int) ([]sysfs.CacheInfo, error) {
|
||||
|
||||
func GetNetworkStats(name string) (info.InterfaceStats, error) {
|
||||
// TODO(rjnagal): Take syfs as an argument.
|
||||
sysFs, err := sysfs.NewRealSysFs()
|
||||
if err != nil {
|
||||
return info.InterfaceStats{}, err
|
||||
}
|
||||
sysFs := sysfs.NewRealSysFs()
|
||||
return getNetworkStats(name, sysFs)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user