Documentation ¶
Index ¶
- Constants
- func NewListener(addr string) (net.Listener, error)
- func NewPackageStats(now time.Time, size int) *packageStats
- func NewRaftFollowersStats(name string) *raftFollowersStats
- func NewRaftServerStats(name string) *raftServerStats
- func NewTLSListener(addr string, cfg *tls.Config) (net.Listener, error)
- func NewTransporter(followersStats *raftFollowersStats, serverStats *raftServerStats, ...) *transporter
- func Usage() string
- type JoinCommand
- type PeerServer
- func (ps *PeerServer) AppendEntriesHttpHandler(w http.ResponseWriter, req *http.Request)
- func (ps *PeerServer) EtcdURLHttpHandler(w http.ResponseWriter, req *http.Request)
- func (ps *PeerServer) GetLogHttpHandler(w http.ResponseWriter, req *http.Request)
- func (s *PeerServer) HTTPHandler() http.Handler
- func (ps *PeerServer) JoinHttpHandler(w http.ResponseWriter, req *http.Request)
- func (ps *PeerServer) NameHttpHandler(w http.ResponseWriter, req *http.Request)
- func (s *PeerServer) PeerStats() []byte
- func (s *PeerServer) RaftServer() raft.Server
- func (ps *PeerServer) RemoveHttpHandler(w http.ResponseWriter, req *http.Request)
- func (s *PeerServer) SetRaftServer(raftServer raft.Server)
- func (s *PeerServer) SetServer(server *Server)
- func (ps *PeerServer) SnapshotHttpHandler(w http.ResponseWriter, req *http.Request)
- func (ps *PeerServer) SnapshotRecoveryHttpHandler(w http.ResponseWriter, req *http.Request)
- func (s *PeerServer) Start(snapshot bool, cluster []string) error
- func (s *PeerServer) Stats() []byte
- func (s *PeerServer) Stop()
- func (s *PeerServer) Upgradable() error
- func (ps *PeerServer) UpgradeHttpHandler(w http.ResponseWriter, req *http.Request)
- func (ps *PeerServer) VersionCheckHttpHandler(w http.ResponseWriter, req *http.Request)
- func (ps *PeerServer) VersionHttpHandler(w http.ResponseWriter, req *http.Request)
- func (ps *PeerServer) VoteHttpHandler(w http.ResponseWriter, req *http.Request)
- type PeerServerConfig
- type Registry
- func (r *Registry) ClientURL(name string) (string, bool)
- func (r *Registry) ClientURLs(leaderName, selfName string) []string
- func (r *Registry) Count() int
- func (r *Registry) Invalidate(name string)
- func (r *Registry) PeerURL(name string) (string, bool)
- func (r *Registry) PeerURLs(leaderName, selfName string) []string
- func (r *Registry) Register(name string, peerURL string, machURL string) error
- func (r *Registry) Unregister(name string) error
- type RemoveCommand
- type Server
- func (s *Server) ClientURL(name string) (string, bool)
- func (s *Server) CommitIndex() uint64
- func (s *Server) Dispatch(c raft.Command, w http.ResponseWriter, req *http.Request) error
- func (s *Server) EnableTracing()
- func (s *Server) GetLeaderHandler(w http.ResponseWriter, req *http.Request) error
- func (s *Server) GetLeaderStatsHandler(w http.ResponseWriter, req *http.Request) error
- func (s *Server) GetMetricsHandler(w http.ResponseWriter, req *http.Request) error
- func (s *Server) GetPeersHandler(w http.ResponseWriter, req *http.Request) error
- func (s *Server) GetStatsHandler(w http.ResponseWriter, req *http.Request) error
- func (s *Server) GetStoreStatsHandler(w http.ResponseWriter, req *http.Request) error
- func (s *Server) GetVersionHandler(w http.ResponseWriter, req *http.Request) error
- func (s *Server) HTTPHandler() http.Handler
- func (s *Server) Leader() string
- func (s *Server) PeerURL(name string) (string, bool)
- func (s *Server) SpeedTestHandler(w http.ResponseWriter, req *http.Request) error
- func (s *Server) State() string
- func (s *Server) Store() store.Store
- func (s *Server) Term() uint64
- func (s *Server) URL() string
- type TLSInfo
Constants ¶
const RegistryKey = "/_etcd/machines"
The location of the peer URL data.
const ReleaseVersion = "v0.3.0"
const ThresholdMonitorTimeout = 5 * time.Second
const Version = "v2"
Variables ¶
This section is empty.
Functions ¶
func NewPackageStats ¶
NewPackageStats creates a pacakgeStats and return the pointer to it.
func NewRaftFollowersStats ¶ added in v0.3.0
func NewRaftFollowersStats(name string) *raftFollowersStats
func NewRaftServerStats ¶ added in v0.3.0
func NewRaftServerStats(name string) *raftServerStats
func NewTLSListener ¶ added in v0.3.0
func NewTransporter ¶ added in v0.3.0
func NewTransporter(followersStats *raftFollowersStats, serverStats *raftServerStats, registry *Registry, dialTimeout, requestTimeout, responseHeaderTimeout time.Duration) *transporter
Create transporter using by raft server Create http or https transporter based on whether the user give the server cert and key
Types ¶
type JoinCommand ¶
type JoinCommand struct { MinVersion int `json:"minVersion"` MaxVersion int `json:"maxVersion"` Name string `json:"name"` RaftURL string `json:"raftURL"` EtcdURL string `json:"etcdURL"` }
The JoinCommand adds a node to the cluster.
func NewJoinCommand ¶
func NewJoinCommand(minVersion int, maxVersion int, name, raftUrl, etcdUrl string) *JoinCommand
func (*JoinCommand) Apply ¶
func (c *JoinCommand) Apply(context raft.Context) (interface{}, error)
Join a server to the cluster
func (*JoinCommand) CommandName ¶
func (c *JoinCommand) CommandName() string
The name of the join command in the log
func (*JoinCommand) NodeName ¶
func (c *JoinCommand) NodeName() string
type PeerServer ¶
type PeerServer struct { Config PeerServerConfig // contains filtered or unexported fields }
func NewPeerServer ¶
func NewPeerServer(psConfig PeerServerConfig, registry *Registry, store store.Store, mb *metrics.Bucket, followersStats *raftFollowersStats, serverStats *raftServerStats) *PeerServer
func (*PeerServer) AppendEntriesHttpHandler ¶
func (ps *PeerServer) AppendEntriesHttpHandler(w http.ResponseWriter, req *http.Request)
Response to append entries request
func (*PeerServer) EtcdURLHttpHandler ¶
func (ps *PeerServer) EtcdURLHttpHandler(w http.ResponseWriter, req *http.Request)
Get the port that listening for etcd connecting of the server
func (*PeerServer) GetLogHttpHandler ¶
func (ps *PeerServer) GetLogHttpHandler(w http.ResponseWriter, req *http.Request)
Get all the current logs
func (*PeerServer) HTTPHandler ¶ added in v0.3.0
func (s *PeerServer) HTTPHandler() http.Handler
func (*PeerServer) JoinHttpHandler ¶
func (ps *PeerServer) JoinHttpHandler(w http.ResponseWriter, req *http.Request)
Response to the join request
func (*PeerServer) NameHttpHandler ¶
func (ps *PeerServer) NameHttpHandler(w http.ResponseWriter, req *http.Request)
Response to the name request
func (*PeerServer) PeerStats ¶
func (s *PeerServer) PeerStats() []byte
func (*PeerServer) RaftServer ¶
func (s *PeerServer) RaftServer() raft.Server
Retrieves the underlying Raft server.
func (*PeerServer) RemoveHttpHandler ¶
func (ps *PeerServer) RemoveHttpHandler(w http.ResponseWriter, req *http.Request)
Response to remove request
func (*PeerServer) SetRaftServer ¶ added in v0.3.0
func (s *PeerServer) SetRaftServer(raftServer raft.Server)
func (*PeerServer) SetServer ¶
func (s *PeerServer) SetServer(server *Server)
Associates the client server with the peer server.
func (*PeerServer) SnapshotHttpHandler ¶
func (ps *PeerServer) SnapshotHttpHandler(w http.ResponseWriter, req *http.Request)
Response to recover from snapshot request
func (*PeerServer) SnapshotRecoveryHttpHandler ¶
func (ps *PeerServer) SnapshotRecoveryHttpHandler(w http.ResponseWriter, req *http.Request)
Response to recover from snapshot request
func (*PeerServer) Start ¶ added in v0.3.0
func (s *PeerServer) Start(snapshot bool, cluster []string) error
Start the raft server
func (*PeerServer) Stats ¶
func (s *PeerServer) Stats() []byte
func (*PeerServer) Stop ¶ added in v0.3.0
func (s *PeerServer) Stop()
func (*PeerServer) Upgradable ¶
func (s *PeerServer) Upgradable() error
Upgradable checks whether all peers in a cluster support an upgrade to the next store version.
func (*PeerServer) UpgradeHttpHandler ¶
func (ps *PeerServer) UpgradeHttpHandler(w http.ResponseWriter, req *http.Request)
Upgrades the current store version to the next version.
func (*PeerServer) VersionCheckHttpHandler ¶
func (ps *PeerServer) VersionCheckHttpHandler(w http.ResponseWriter, req *http.Request)
Checks whether a given version is supported.
func (*PeerServer) VersionHttpHandler ¶
func (ps *PeerServer) VersionHttpHandler(w http.ResponseWriter, req *http.Request)
Response to the name request
func (*PeerServer) VoteHttpHandler ¶
func (ps *PeerServer) VoteHttpHandler(w http.ResponseWriter, req *http.Request)
Response to vote request
type PeerServerConfig ¶ added in v0.3.0
type Registry ¶
The Registry stores URL information for nodes.
func (*Registry) ClientURLs ¶
Retrieves the Client URLs for all nodes.
func (*Registry) Invalidate ¶
Removes a node from the cache.
func (*Registry) Unregister ¶
Removes a node from the registry.
type RemoveCommand ¶
type RemoveCommand struct {
Name string `json:"name"`
}
The RemoveCommand removes a server from the cluster.
func (*RemoveCommand) Apply ¶
func (c *RemoveCommand) Apply(context raft.Context) (interface{}, error)
Remove a server from the cluster
func (*RemoveCommand) CommandName ¶
func (c *RemoveCommand) CommandName() string
The name of the remove command in the log
type Server ¶
type Server struct { Name string // contains filtered or unexported fields }
This is the default implementation of the Server interface.
func New ¶
func New(name, url string, peerServer *PeerServer, registry *Registry, store store.Store, mb *metrics.Bucket) *Server
Creates a new Server.
func (*Server) CommitIndex ¶
The current Raft committed index.
func (*Server) EnableTracing ¶ added in v0.3.0
func (s *Server) EnableTracing()
func (*Server) GetLeaderHandler ¶
Handler to return the current leader's raft address
func (*Server) GetLeaderStatsHandler ¶
Retrieves stats on the leader.
func (*Server) GetMetricsHandler ¶ added in v0.3.0
Retrieves metrics from bucket
func (*Server) GetPeersHandler ¶
Handler to return all the known peers in the current cluster.
func (*Server) GetStatsHandler ¶
Retrieves stats on the Raft server.
func (*Server) GetStoreStatsHandler ¶
Retrieves stats on the leader.
func (*Server) GetVersionHandler ¶
Handler to return the current version of etcd.
func (*Server) HTTPHandler ¶ added in v0.3.0
func (*Server) SpeedTestHandler ¶
Executes a speed test to evaluate the performance of update replication.