Browse Source

etcdserver: move stats inferface to stats pkg

Xiang Li 11 years ago
parent
commit
935f7128a9
3 changed files with 13 additions and 11 deletions
  1. 2 1
      etcdserver/etcdhttp/client.go
  2. 0 10
      etcdserver/server.go
  3. 11 0
      etcdserver/stats/stats.go

+ 2 - 1
etcdserver/etcdhttp/client.go

@@ -35,6 +35,7 @@ import (
 	"github.com/coreos/etcd/etcdserver"
 	"github.com/coreos/etcd/etcdserver"
 	"github.com/coreos/etcd/etcdserver/etcdhttp/httptypes"
 	"github.com/coreos/etcd/etcdserver/etcdhttp/httptypes"
 	"github.com/coreos/etcd/etcdserver/etcdserverpb"
 	"github.com/coreos/etcd/etcdserver/etcdserverpb"
+	"github.com/coreos/etcd/etcdserver/stats"
 	"github.com/coreos/etcd/pkg/types"
 	"github.com/coreos/etcd/pkg/types"
 	"github.com/coreos/etcd/store"
 	"github.com/coreos/etcd/store"
 	"github.com/coreos/etcd/version"
 	"github.com/coreos/etcd/version"
@@ -236,7 +237,7 @@ func (h *membersHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 }
 }
 
 
 type statsHandler struct {
 type statsHandler struct {
-	stats etcdserver.Stats
+	stats stats.Stats
 }
 }
 
 
 func (h *statsHandler) serveStore(w http.ResponseWriter, r *http.Request) {
 func (h *statsHandler) serveStore(w http.ResponseWriter, r *http.Request) {

+ 0 - 10
etcdserver/server.go

@@ -135,16 +135,6 @@ type Server interface {
 	UpdateMember(ctx context.Context, updateMemb Member) error
 	UpdateMember(ctx context.Context, updateMemb Member) error
 }
 }
 
 
-type Stats interface {
-	// SelfStats returns the struct representing statistics of this server
-	SelfStats() []byte
-	// LeaderStats returns the statistics of all followers in the cluster
-	// if this server is leader. Otherwise, nil is returned.
-	LeaderStats() []byte
-	// StoreStats returns statistics of the store backing this EtcdServer
-	StoreStats() []byte
-}
-
 type RaftTimer interface {
 type RaftTimer interface {
 	Index() uint64
 	Index() uint64
 	Term() uint64
 	Term() uint64

+ 11 - 0
etcdserver/stats/stats.go

@@ -0,0 +1,11 @@
+package stats
+
+type Stats interface {
+	// SelfStats returns the struct representing statistics of this server
+	SelfStats() []byte
+	// LeaderStats returns the statistics of all followers in the cluster
+	// if this server is leader. Otherwise, nil is returned.
+	LeaderStats() []byte
+	// StoreStats returns statistics of the store backing this EtcdServer
+	StoreStats() []byte
+}