Documentation ¶
Overview ¶
Package proc manages etcd processes.
Index ¶
- func CombineFlags(remote bool, cs ...*Flags) error
- type Cluster
- type Flags
- type Node
- type NodeType
- type NodeWebLocal
- func (nd *NodeWebLocal) Clean() error
- func (nd *NodeWebLocal) Endpoint() string
- func (nd *NodeWebLocal) IsActive() bool
- func (nd *NodeWebLocal) Restart() error
- func (nd *NodeWebLocal) Start() error
- func (nd *NodeWebLocal) StatusEndpoint() string
- func (nd *NodeWebLocal) TLS() *tls.Config
- func (nd *NodeWebLocal) Terminate() error
- func (nd *NodeWebLocal) Write(p []byte) (int, error)
- type NodeWebRemoteClient
- func (nd *NodeWebRemoteClient) Clean() error
- func (nd *NodeWebRemoteClient) Endpoint() string
- func (nd *NodeWebRemoteClient) IsActive() bool
- func (nd *NodeWebRemoteClient) Restart() error
- func (nd *NodeWebRemoteClient) Start() error
- func (nd *NodeWebRemoteClient) StatusEndpoint() string
- func (nd *NodeWebRemoteClient) TLS() *tls.Config
- func (nd *NodeWebRemoteClient) Terminate() error
- type OpOption
- type ServerStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CombineFlags ¶
CombineFlags combine flags under a same cluster.
Types ¶
type Cluster ¶
type Cluster interface { // Write writes messages to a Node process. Write(name, msg string, streamIDs ...string) error SharedStream() chan string // Stream returns the channel for streaming logs. Stream(streamID string) chan string // Start starts Node process. Start(name string) error // Restart restarts Node process. Restart(name string) error // Revive restarts all Nodes in case no Node is up for a certain period of // time. Revive() error // Terminate kills the Node process. Terminate(name string) error // Clean cleans up the resources from the Node. This must be called // after Terminate. Clean(name string) error // Bootstrap starts all Node processes. Bootstrap() error // Shutdown terminates and cleans all Nodes. Shutdown() error // Endpoints returns all endpoints for clients and a map of name and endpoint, vice versa. Endpoints() ([]string, map[string]string, map[string]string) // Leader returns the name of the leader. Leader() (string, error) // Status returns all endpoints and status of the cluster. Status() (map[string]ServerStatus, error) // Put puts key-value to the cluster. If the name is not specified, it // sends request to a random node. Put(name, key, value string, streamIDs ...string) (time.Duration, error) // Get get the value from the key. If the name is not specified, // it gets from a random node. Get(name, key string, prefix bool, streamIDs ...string) ([]string, time.Duration, error) // Delete deletes the key. Delete(ame, key string, prefix bool, streamIDs ...string) (int64, time.Duration, error) // Stress stresses the cluster. If the name is not specified, it stresses // random nodes. Stress(name string, stressN int, streamIDs ...string) (time.Duration, error) }
Cluster controls a set of Nodes.
type Flags ¶
type Flags struct { Name string `flag:"name"` DataDir string `flag:"data-dir"` ListenClientURLs map[string]struct{} `flag:"listen-client-urls"` AdvertiseClientURLs map[string]struct{} `flag:"advertise-client-urls"` ListenPeerURLs map[string]struct{} `flag:"listen-peer-urls"` AdvertisePeerURLs map[string]struct{} `flag:"initial-advertise-peer-urls"` InitialCluster map[string]string `flag:"initial-cluster"` InitialClusterToken string `flag:"initial-cluster-token"` InitialClusterState string `flag:"initial-cluster-state"` ClientAutoTLS bool `flag:"auto-tls"` PeerAutoTLS bool `flag:"peer-auto-tls"` }
Flags is a set of etcd flags.
func GenerateFlags ¶
GenerateFlags returns generated default flags.
func (*Flags) StringSlice ¶
type Node ¶
type Node interface { // Endpoint returns the gRPC endpoint. Endpoint() string // StatusEndpoint returns the v2 status endpoint. StatusEndpoint() string // IsActive returns true if the Node is running(active). IsActive() bool // Start starts Node process. Start() error // Restart restarts Node process. Restart() error // Terminate kills the Node process. Terminate() error // Clean cleans up the resources from the Node. This must be called // after Terminate. Clean() error // TLS returns the *tls.Config of the Node. TLS() *tls.Config }
Node contains node operations.
type NodeWebLocal ¶
type NodeWebLocal struct { ProgramPath string Flags *Flags TLSCertPath string TLSKeyPath string TLSConfig *tls.Config PID int // contains filtered or unexported fields }
NodeWebLocal represents an etcd node in local web host.
func (*NodeWebLocal) Clean ¶
func (nd *NodeWebLocal) Clean() error
func (*NodeWebLocal) Endpoint ¶
func (nd *NodeWebLocal) Endpoint() string
func (*NodeWebLocal) IsActive ¶
func (nd *NodeWebLocal) IsActive() bool
func (*NodeWebLocal) Restart ¶
func (nd *NodeWebLocal) Restart() error
func (*NodeWebLocal) Start ¶
func (nd *NodeWebLocal) Start() error
func (*NodeWebLocal) StatusEndpoint ¶
func (nd *NodeWebLocal) StatusEndpoint() string
func (*NodeWebLocal) TLS ¶
func (nd *NodeWebLocal) TLS() *tls.Config
func (*NodeWebLocal) Terminate ¶
func (nd *NodeWebLocal) Terminate() error
type NodeWebRemoteClient ¶
type NodeWebRemoteClient struct { Flags *Flags TLSCertPath string TLSKeyPath string TLSConfig *tls.Config Agent client.Agent // contains filtered or unexported fields }
func (*NodeWebRemoteClient) Clean ¶
func (nd *NodeWebRemoteClient) Clean() error
func (*NodeWebRemoteClient) Endpoint ¶
func (nd *NodeWebRemoteClient) Endpoint() string
func (*NodeWebRemoteClient) IsActive ¶
func (nd *NodeWebRemoteClient) IsActive() bool
func (*NodeWebRemoteClient) Restart ¶
func (nd *NodeWebRemoteClient) Restart() error
func (*NodeWebRemoteClient) Start ¶
func (nd *NodeWebRemoteClient) Start() error
func (*NodeWebRemoteClient) StatusEndpoint ¶
func (nd *NodeWebRemoteClient) StatusEndpoint() string
func (*NodeWebRemoteClient) TLS ¶
func (nd *NodeWebRemoteClient) TLS() *tls.Config
func (*NodeWebRemoteClient) Terminate ¶
func (nd *NodeWebRemoteClient) Terminate() error
type OpOption ¶
type OpOption func(*op)
func WithAgentEndpoints ¶
WithAgentEndpoins specifies etcd-agent endpoints. Only applicable for 'etcd-play web' command when deployed with remote machines.
func WithLimitInterval ¶
WithLimitInterval puts limit interval between terminate and immediate restart, restart and immediate terminate.
func WithLiveLog ¶
func WithLiveLog() OpOption
WithLiveLog feeds etcd logs real-time. Only applicable for 'etcd-play web' command in localhost.
Click to show internal directories.
Click to hide internal directories.