Skip to content

Commit

Permalink
Refactoring.
Browse files Browse the repository at this point in the history
Docker-DCO-1.1-Signed-off-by: Vishnu Kannan <vishnuk@google.com> (github: vishh)
  • Loading branch information
vishh committed Jun 26, 2014
1 parent 98c2593 commit ab4201f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
8 changes: 4 additions & 4 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import (

// Returns all available stats for the given container.
func GetContainerStats(container *Config, state *State) (*ContainerStats, error) {
containerStats := NewContainerStats()
var containerStats ContainerStats
stats, err := fs.GetStats(container.Cgroups)
if err != nil {
return containerStats, err
return &containerStats, err
}
containerStats.CgroupStats = stats
networkStats, err := network.GetStats(&state.NetworkState)
if err != nil {
return containerStats, err
return &containerStats, err
}
containerStats.NetworkStats = networkStats

return containerStats, nil
return &containerStats, nil
}
5 changes: 0 additions & 5 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,3 @@ type ContainerStats struct {
NetworkStats network.NetworkStats `json:"network_stats, omitempty"`
CgroupStats *cgroups.Stats `json:"cgroup_stats, omitempty"`
}

func NewContainerStats() *ContainerStats {
cgroupStats := cgroups.NewStats()
return &ContainerStats{CgroupStats: cgroupStats}
}

0 comments on commit ab4201f

Please sign in to comment.