Documentation ¶
Index ¶
- Variables
- func ClientURL(address string, tlsEnabled bool) string
- func ClientsURLs(addresses []string, tlsEnabled bool) (cURLs []string)
- func URL2Address(pURL string) string
- type Client
- func (c *Client) AddMember(name string, pURLs []string) (uint64, func(), error)
- func (c *Client) Cleanup() error
- func (c *Client) ForEachMember(f func(*Client, *etcdserverpb.Member) error) error
- func (c *Client) GetHighestRevision() (int64, error)
- func (c *Client) GetRevisionsHashes() (map[string]int64, map[string]int64, error)
- func (c *Client) IsConsistent() error
- func (c *Client) IsHealthy(retries int, timeout time.Duration) bool
- func (c *Client) Lock(name string, maxWait time.Duration) (func(), error)
- func (c *Client) Members() ([]*etcdserverpb.Member, error)
- func (c *Client) RemoveMember(name string, id uint64) error
- type EtcdConfiguration
- type SecurityConfig
- type Server
- func (c *Server) IsRunning() bool
- func (c *Server) Join(cluster *Client) error
- func (c *Server) Restore(metadata *snapshot.Metadata) error
- func (c *Server) Seed(snapshot *snapshot.Metadata) error
- func (c *Server) Snapshot() error
- func (c *Server) SnapshotInfo() (*snapshot.Metadata, error)
- func (c *Server) Stop(graceful, snapshot bool)
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMemberRevisionTooOld = errors.New("member revision older than the minimum desired revision")
Functions ¶
func ClientsURLs ¶
func URL2Address ¶
Types ¶
type Client ¶
type Client struct { *clientv3.Client SC SecurityConfig TC *tls.Config // contains filtered or unexported fields }
func NewClient ¶
func NewClient(clientsAddresses []string, sc SecurityConfig, autoSync bool) (*Client, error)
NewClient creates a new etcd client wrapper.
The client must be closed.
func (*Client) ForEachMember ¶
func (*Client) GetHighestRevision ¶
func (*Client) GetRevisionsHashes ¶
func (*Client) IsConsistent ¶
func (*Client) IsHealthy ¶
IsHealthy verifies if the cluster is healthy / has quorum, or when a single address is given and autoSync is off, if the member behind that address is responsive (and not that the overall cluster is operating).
For checking the health of the entire cluster, IsHealthy simply leverages linearizable reads, which are reads that must go through raft. Even if a few members are unreachable or isolated, IsHealthy is able to respond correctly thanks to the smart underlying balancer in the client.
type EtcdConfiguration ¶
type EtcdConfiguration struct { AdvertiseAddress string `yaml:"advertise-address"` DataDir string `yaml:"data-dir"` ClientTransportSecurity SecurityConfig `yaml:"client-transport-security"` PeerTransportSecurity SecurityConfig `yaml:"peer-transport-security"` BackendQuota int64 `yaml:"backend-quota"` }
EtcdConfiguration contains the configuration related to the underlying etcd server.
type SecurityConfig ¶
type SecurityConfig struct { CAFile string `yaml:"ca-file"` CertFile string `yaml:"cert-file"` KeyFile string `yaml:"key-file"` CertAuth bool `yaml:"client-cert-auth"` TrustedCAFile string `yaml:"trusted-ca-file"` AutoTLS bool `yaml:"auto-tls"` }
func (SecurityConfig) ClientConfig ¶
func (sc SecurityConfig) ClientConfig() (*tls.Config, error)
func (SecurityConfig) TLSEnabled ¶
func (sc SecurityConfig) TLSEnabled() bool
func (SecurityConfig) TLSInfo ¶
func (sc SecurityConfig) TLSInfo() transport.TLSInfo
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(cfg ServerConfig) *Server
type ServerConfig ¶
type ServerConfig struct { Name string DataDir string DataQuota int64 PublicAddress string PrivateAddress string ClientSC SecurityConfig PeerSC SecurityConfig UnhealthyMemberTTL time.Duration // Optional, used in {Seed, Join} to periodically save snapshots. SnapshotProvider snapshot.Provider SnapshotInterval time.Duration SnapshotTTL time.Duration // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.