package server
import "github.com/coreos/etcd/server"
Index ¶
- Constants
- func NewPackageStats(now time.Time, size int) *packageStats
- type JoinCommand
- func NewJoinCommand(version, name, raftUrl, etcdUrl string) *JoinCommand
- func (c *JoinCommand) Apply(server raft.Server) (interface{}, error)
- func (c *JoinCommand) CommandName() string
- func (c *JoinCommand) NodeName() string
- type PeerServer
- func NewPeerServer(name string, path string, url string, listenHost string, tlsConf *TLSConfig, tlsInfo *TLSInfo, registry *Registry, store store.Store) *PeerServer
- func (s *PeerServer) AppendEntriesHttpHandler(w http.ResponseWriter, req *http.Request)
- func (s *PeerServer) EtcdURLHttpHandler(w http.ResponseWriter, req *http.Request)
- func (s *PeerServer) GetLogHttpHandler(w http.ResponseWriter, req *http.Request)
- func (s *PeerServer) JoinHttpHandler(w http.ResponseWriter, req *http.Request)
- func (s *PeerServer) ListenAndServe(snapshot bool, cluster []string)
- func (s *PeerServer) NameHttpHandler(w http.ResponseWriter, req *http.Request)
- func (s *PeerServer) PeerStats() []byte
- func (s *PeerServer) RaftServer() raft.Server
- func (s *PeerServer) RaftVersionHttpHandler(w http.ResponseWriter, req *http.Request)
- func (s *PeerServer) RemoveHttpHandler(w http.ResponseWriter, req *http.Request)
- func (s *PeerServer) SetServer(server *Server)
- func (s *PeerServer) SnapshotHttpHandler(w http.ResponseWriter, req *http.Request)
- func (s *PeerServer) SnapshotRecoveryHttpHandler(w http.ResponseWriter, req *http.Request)
- func (s *PeerServer) Stats() []byte
- func (s *PeerServer) VoteHttpHandler(w http.ResponseWriter, req *http.Request)
- type Registry
- func NewRegistry(s store.Store) *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, peerVersion string, peerURL string, url string, commitIndex uint64, term uint64) error
- func (r *Registry) Unregister(name string, commitIndex uint64, term uint64) error
- type RemoveCommand
- func (c *RemoveCommand) Apply(server raft.Server) (interface{}, error)
- func (c *RemoveCommand) CommandName() string
- type Server
- func New(name string, urlStr string, listenHost string, tlsConf *TLSConfig, tlsInfo *TLSInfo, peerServer *PeerServer, registry *Registry, store store.Store) *Server
- func (s *Server) AllowOrigins(origins string) error
- func (s *Server) CommitIndex() uint64
- func (s *Server) Dispatch(c raft.Command, w http.ResponseWriter, req *http.Request) error
- 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) GetMachinesHandler(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) Leader() string
- func (s *Server) ListenAndServe()
- func (s *Server) OriginAllowed(origin string) bool
- 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 TLSConfig
- type TLSInfo
Constants ¶
const ( // The amount of time to elapse without a heartbeat before becoming a candidate. ElectionTimeout = 200 * time.Millisecond // The frequency by which heartbeats are sent to followers. HeartbeatTimeout = 50 * time.Millisecond RetryInterval = 10 )
const PeerVersion = ReleaseVersion
TODO: The release version (generated from the git tag) will be the raft protocol version for now. When things settle down we will fix it like the client API above.
const RegistryKey = "/_etcd/machines"
The location of the machine URL data.
const Version = "v2"
Functions ¶
func NewPackageStats ¶
NewPackageStats creates a pacakgeStats and return the pointer to it.
Types ¶
type JoinCommand ¶
type JoinCommand struct { RaftVersion string `json:"raftVersion"` Name string `json:"name"` RaftURL string `json:"raftURL"` EtcdURL string `json:"etcdURL"` }
The JoinCommand adds a node to the cluster.
func NewJoinCommand ¶
func NewJoinCommand(version, name, raftUrl, etcdUrl string) *JoinCommand
func (*JoinCommand) Apply ¶
func (c *JoinCommand) Apply(server raft.Server) (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 { MaxClusterSize int RetryTimes int // contains filtered or unexported fields }
func NewPeerServer ¶
func NewPeerServer(name string, path string, url string, listenHost string, tlsConf *TLSConfig, tlsInfo *TLSInfo, registry *Registry, store store.Store) *PeerServer
func (*PeerServer) AppendEntriesHttpHandler ¶
func (s *PeerServer) AppendEntriesHttpHandler(w http.ResponseWriter, req *http.Request)
Response to append entries request
func (*PeerServer) EtcdURLHttpHandler ¶
func (s *PeerServer) EtcdURLHttpHandler(w http.ResponseWriter, req *http.Request)
Get the port that listening for etcd connecting of the server
func (*PeerServer) GetLogHttpHandler ¶
func (s *PeerServer) GetLogHttpHandler(w http.ResponseWriter, req *http.Request)
Get all the current logs
func (*PeerServer) JoinHttpHandler ¶
func (s *PeerServer) JoinHttpHandler(w http.ResponseWriter, req *http.Request)
Response to the join request
func (*PeerServer) ListenAndServe ¶
func (s *PeerServer) ListenAndServe(snapshot bool, cluster []string)
Start the raft server
func (*PeerServer) NameHttpHandler ¶
func (s *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) RaftVersionHttpHandler ¶
func (s *PeerServer) RaftVersionHttpHandler(w http.ResponseWriter, req *http.Request)
Response to the name request
func (*PeerServer) RemoveHttpHandler ¶
func (s *PeerServer) RemoveHttpHandler(w http.ResponseWriter, req *http.Request)
Response to remove request
func (*PeerServer) SetServer ¶
func (s *PeerServer) SetServer(server *Server)
Associates the client server with the peer server.
func (*PeerServer) SnapshotHttpHandler ¶
func (s *PeerServer) SnapshotHttpHandler(w http.ResponseWriter, req *http.Request)
Response to recover from snapshot request
func (*PeerServer) SnapshotRecoveryHttpHandler ¶
func (s *PeerServer) SnapshotRecoveryHttpHandler(w http.ResponseWriter, req *http.Request)
Response to recover from snapshot request
func (*PeerServer) Stats ¶
func (s *PeerServer) Stats() []byte
func (*PeerServer) VoteHttpHandler ¶
func (s *PeerServer) VoteHttpHandler(w http.ResponseWriter, req *http.Request)
Response to vote request
type Registry ¶
The Registry stores URL information for nodes.
func NewRegistry ¶
Creates a new Registry.
func (*Registry) ClientURL ¶
Retrieves the client URL for a given node by name.
func (*Registry) ClientURLs ¶
Retrieves the Client URLs for all nodes.
func (*Registry) Count ¶
Returns the number of nodes in the cluster.
func (*Registry) Invalidate ¶
Removes a node from the cache.
func (*Registry) PeerURL ¶
Retrieves the peer URL for a given node by name.
func (*Registry) PeerURLs ¶
Retrieves the Peer URLs for all nodes.
func (*Registry) Register ¶
func (r *Registry) Register(name string, peerVersion string, peerURL string, url string, commitIndex uint64, term uint64) error
Adds a node to the registry.
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(server raft.Server) (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 ¶
This is the default implementation of the Server interface.
func New ¶
func New(name string, urlStr string, listenHost string, tlsConf *TLSConfig, tlsInfo *TLSInfo, peerServer *PeerServer, registry *Registry, store store.Store) *Server
Creates a new Server.
func (*Server) AllowOrigins ¶
Sets a comma-delimited list of origins that are allowed.
func (*Server) CommitIndex ¶
The current Raft committed index.
func (*Server) Dispatch ¶
func (*Server) GetLeaderHandler ¶
Handler to return the current leader's raft address
func (*Server) GetLeaderStatsHandler ¶
Retrieves stats on the leader.
func (*Server) GetMachinesHandler ¶
Handler to return all the known machines 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) Leader ¶
The node name of the leader in the cluster.
func (*Server) ListenAndServe ¶
func (s *Server) ListenAndServe()
Start to listen and response etcd client command
func (*Server) OriginAllowed ¶
Determines whether the server will allow a given CORS origin.
func (*Server) PeerURL ¶
Retrives the Peer URL for a given node name.
func (*Server) SpeedTestHandler ¶
Executes a speed test to evaluate the performance of update replication.
func (*Server) State ¶
The current state of the server in the cluster.
func (*Server) Store ¶
Returns a reference to the Store.
func (*Server) Term ¶
The current Raft term.
func (*Server) URL ¶
The server URL.
type TLSConfig ¶
type TLSInfo ¶
type TLSInfo struct { CertFile string `json:"CertFile"` KeyFile string `json:"KeyFile"` CAFile string `json:"CAFile"` }
Source Files ¶
join_command.go package_stats.go peer_server.go peer_server_handlers.go raft_follower_stats.go raft_server_stats.go registry.go remove_command.go server.go stats_queue.go timeout.go tls_config.go tls_info.go transporter.go util.go version.go
Directories ¶
Path | Synopsis |
---|---|
server/v1 | |
server/v2 |
- Version
- v0.2.0-rc0
- Published
- Oct 17, 2013
- Platform
- windows/amd64
- Imports
- 24 packages
- Last checked
- 1 second ago –
Tools for package owners.