浏览代码

Merge pull request #36494 from stevvooe/remove-unnecessary-types-file

daemon/stats: remove obnoxious types file
Yong Tang 7 年之前
父节点
当前提交
4db41f1a69
共有 2 个文件被更改,包括 33 次插入42 次删除
  1. 33 0
      daemon/stats/collector.go
  2. 0 42
      daemon/stats/types.go

+ 33 - 0
daemon/stats/collector.go

@@ -1,6 +1,8 @@
 package stats // import "github.com/docker/docker/daemon/stats"
 
 import (
+	"bufio"
+	"sync"
 	"time"
 
 	"github.com/docker/docker/api/types"
@@ -9,6 +11,37 @@ import (
 	"github.com/sirupsen/logrus"
 )
 
+// Collector manages and provides container resource stats
+type Collector struct {
+	m          sync.Mutex
+	supervisor supervisor
+	interval   time.Duration
+	publishers map[*container.Container]*pubsub.Publisher
+	bufReader  *bufio.Reader
+
+	// The following fields are not set on Windows currently.
+	clockTicksPerSecond uint64
+}
+
+// NewCollector creates a stats collector that will poll the supervisor with the specified interval
+func NewCollector(supervisor supervisor, interval time.Duration) *Collector {
+	s := &Collector{
+		interval:   interval,
+		supervisor: supervisor,
+		publishers: make(map[*container.Container]*pubsub.Publisher),
+		bufReader:  bufio.NewReaderSize(nil, 128),
+	}
+
+	platformNewStatsCollector(s)
+
+	return s
+}
+
+type supervisor interface {
+	// GetContainerStats collects all the stats related to a container
+	GetContainerStats(container *container.Container) (*types.StatsJSON, error)
+}
+
 // Collect registers the container with the collector and adds it to
 // the event loop for collection on the specified interval returning
 // a channel for the subscriber to receive on.

+ 0 - 42
daemon/stats/types.go

@@ -1,42 +0,0 @@
-package stats // import "github.com/docker/docker/daemon/stats"
-
-import (
-	"bufio"
-	"sync"
-	"time"
-
-	"github.com/docker/docker/api/types"
-	"github.com/docker/docker/container"
-	"github.com/docker/docker/pkg/pubsub"
-)
-
-type supervisor interface {
-	// GetContainerStats collects all the stats related to a container
-	GetContainerStats(container *container.Container) (*types.StatsJSON, error)
-}
-
-// NewCollector creates a stats collector that will poll the supervisor with the specified interval
-func NewCollector(supervisor supervisor, interval time.Duration) *Collector {
-	s := &Collector{
-		interval:   interval,
-		supervisor: supervisor,
-		publishers: make(map[*container.Container]*pubsub.Publisher),
-		bufReader:  bufio.NewReaderSize(nil, 128),
-	}
-
-	platformNewStatsCollector(s)
-
-	return s
-}
-
-// Collector manages and provides container resource stats
-type Collector struct {
-	m          sync.Mutex
-	supervisor supervisor
-	interval   time.Duration
-	publishers map[*container.Container]*pubsub.Publisher
-	bufReader  *bufio.Reader
-
-	// The following fields are not set on Windows currently.
-	clockTicksPerSecond uint64
-}