mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
gofmt
This commit is contained in:
@@ -13,8 +13,8 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/coreos/etcd/log"
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
|
"github.com/coreos/etcd/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// The default location for the etcd configuration file.
|
// The default location for the etcd configuration file.
|
||||||
@@ -69,7 +69,7 @@ type Config struct {
|
|||||||
VeryVerbose bool `toml:"very_verbose" env:"ETCD_VERY_VERBOSE"`
|
VeryVerbose bool `toml:"very_verbose" env:"ETCD_VERY_VERBOSE"`
|
||||||
HeartbeatTimeout int `toml:"peer_heartbeat_timeout" env:"ETCD_PEER_HEARTBEAT_TIMEOUT"`
|
HeartbeatTimeout int `toml:"peer_heartbeat_timeout" env:"ETCD_PEER_HEARTBEAT_TIMEOUT"`
|
||||||
ElectionTimeout int `toml:"peer_election_timeout" env:"ETCD_PEER_ELECTION_TIMEOUT"`
|
ElectionTimeout int `toml:"peer_election_timeout" env:"ETCD_PEER_ELECTION_TIMEOUT"`
|
||||||
Peer struct {
|
Peer struct {
|
||||||
Addr string `toml:"addr" env:"ETCD_PEER_ADDR"`
|
Addr string `toml:"addr" env:"ETCD_PEER_ADDR"`
|
||||||
BindAddr string `toml:"bind_addr" env:"ETCD_PEER_BIND_ADDR"`
|
BindAddr string `toml:"bind_addr" env:"ETCD_PEER_BIND_ADDR"`
|
||||||
CAFile string `toml:"ca_file" env:"ETCD_PEER_CA_FILE"`
|
CAFile string `toml:"ca_file" env:"ETCD_PEER_CA_FILE"`
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type corsHandler struct {
|
type corsHandler struct {
|
||||||
router *mux.Router
|
router *mux.Router
|
||||||
corsOrigins map[string]bool
|
corsOrigins map[string]bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,5 +74,3 @@ func (h *corsHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||||||
|
|
||||||
h.router.ServeHTTP(w, req)
|
h.router.ServeHTTP(w, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,23 +23,23 @@ import (
|
|||||||
const retryInterval = 10
|
const retryInterval = 10
|
||||||
|
|
||||||
type PeerServer struct {
|
type PeerServer struct {
|
||||||
raftServer raft.Server
|
raftServer raft.Server
|
||||||
server *Server
|
server *Server
|
||||||
httpServer *http.Server
|
httpServer *http.Server
|
||||||
listener net.Listener
|
listener net.Listener
|
||||||
joinIndex uint64
|
joinIndex uint64
|
||||||
name string
|
name string
|
||||||
url string
|
url string
|
||||||
bindAddr string
|
bindAddr string
|
||||||
tlsConf *TLSConfig
|
tlsConf *TLSConfig
|
||||||
tlsInfo *TLSInfo
|
tlsInfo *TLSInfo
|
||||||
followersStats *raftFollowersStats
|
followersStats *raftFollowersStats
|
||||||
serverStats *raftServerStats
|
serverStats *raftServerStats
|
||||||
registry *Registry
|
registry *Registry
|
||||||
store store.Store
|
store store.Store
|
||||||
snapConf *snapshotConf
|
snapConf *snapshotConf
|
||||||
MaxClusterSize int
|
MaxClusterSize int
|
||||||
RetryTimes int
|
RetryTimes int
|
||||||
HeartbeatTimeout time.Duration
|
HeartbeatTimeout time.Duration
|
||||||
ElectionTimeout time.Duration
|
ElectionTimeout time.Duration
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ func NewPeerServer(name string, path string, url string, bindAddr string, tlsCon
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
HeartbeatTimeout: defaultHeartbeatTimeout,
|
HeartbeatTimeout: defaultHeartbeatTimeout,
|
||||||
ElectionTimeout: defaultElectionTimeout,
|
ElectionTimeout: defaultElectionTimeout,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create transporter for raft
|
// Create transporter for raft
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ func RunServer(f func(*server.Server)) {
|
|||||||
store := store.New()
|
store := store.New()
|
||||||
registry := server.NewRegistry(store)
|
registry := server.NewRegistry(store)
|
||||||
|
|
||||||
ps := server.NewPeerServer(testName, path, "http://" + testRaftURL, testRaftURL, &server.TLSConfig{Scheme: "http"}, &server.TLSInfo{}, registry, store, testSnapshotCount)
|
ps := server.NewPeerServer(testName, path, "http://"+testRaftURL, testRaftURL, &server.TLSConfig{Scheme: "http"}, &server.TLSInfo{}, registry, store, testSnapshotCount)
|
||||||
ps.MaxClusterSize = 9
|
ps.MaxClusterSize = 9
|
||||||
ps.ElectionTimeout = testElectionTimeout
|
ps.ElectionTimeout = testElectionTimeout
|
||||||
ps.HeartbeatTimeout = testHeartbeatTimeout
|
ps.HeartbeatTimeout = testHeartbeatTimeout
|
||||||
s := server.New(testName, "http://" + testClientURL, testClientURL, &server.TLSConfig{Scheme: "http"}, &server.TLSInfo{}, ps, registry, store)
|
s := server.New(testName, "http://"+testClientURL, testClientURL, &server.TLSConfig{Scheme: "http"}, &server.TLSInfo{}, ps, registry, store)
|
||||||
ps.SetServer(s)
|
ps.SetServer(s)
|
||||||
|
|
||||||
// Start up peer server.
|
// Start up peer server.
|
||||||
|
|||||||
Reference in New Issue
Block a user