cluster-api: Index | Files | Directories

package etcd

import ""

Package etcd provides a connection to an etcd member.


Package Files

doc.go etcd.go

type AlarmType Uses

type AlarmType int32
const (
    // AlarmOK denotes that the cluster member is OK.
    AlarmOk AlarmType = iota

    // AlarmNoSpace denotes that the cluster member has run out of disk space.

    // AlarmCorrupt denotes that the cluster member has corrupted data.

type Client Uses

type Client struct {
    EtcdClient etcd
    Endpoint   string
    LeaderID   uint64

Client wraps an etcd client formatting its output to something more consumable.

func NewClient Uses

func NewClient(ctx context.Context, endpoints []string, p proxy.Proxy, tlsConfig *tls.Config) (*Client, error)

NewClient creates a new etcd client with a proxy, and a TLS configuration.

func (*Client) Alarms Uses

func (c *Client) Alarms(ctx context.Context) ([]MemberAlarm, error)

Alarms retrieves all alarms on a cluster.

func (*Client) Close Uses

func (c *Client) Close() error

Close closes the etcd client.

func (*Client) Members Uses

func (c *Client) Members(ctx context.Context) ([]*Member, error)

Members retrieves a list of etcd members.

func (*Client) MoveLeader Uses

func (c *Client) MoveLeader(ctx context.Context, newLeaderID uint64) error

MoveLeader moves the leader to the provided member ID.

func (*Client) RemoveMember Uses

func (c *Client) RemoveMember(ctx context.Context, id uint64) error

RemoveMember removes a given member.

func (*Client) UpdateMemberPeerURLs Uses

func (c *Client) UpdateMemberPeerURLs(ctx context.Context, id uint64, peerURLs []string) ([]*Member, error)

UpdateMemberPeerList updates the list of peer URLs

type GRPCDial Uses

type GRPCDial func(ctx context.Context, addr string) (net.Conn, error)

GRPCDial is a function that creates a connection to a given endpoint.

type Member Uses

type Member struct {
    // ClusterID is the ID of the cluster to which this member belongs
    ClusterID uint64

    // ID is the ID of this cluster member
    ID  uint64

    // Name is the human-readable name of the member. If the member is not started, the name will be an empty string.
    Name string

    // PeerURLs is the list of URLs the member exposes to the cluster for communication.
    PeerURLs []string

    // ClientURLs is the list of URLs the member exposes to clients for communication. If the member is not started, clientURLs will be empty.
    ClientURLs []string

    // IsLearner indicates if the member is raft learner.
    IsLearner bool

    // Alarms is the list of alarms for a member.
    Alarms []AlarmType

Member struct defines an etcd member; it is used to avoid spreading dependencies.

type MemberAlarm Uses

type MemberAlarm struct {
    // MemberID is the ID of the member associated with the raised alarm.
    MemberID uint64

    // Type is the type of alarm which has been raised.
    Type AlarmType

MemberAlarm represents an alarm type association with a cluster member.



Package etcd imports 9 packages (graph) and is imported by 2 packages. Updated 2020-10-27. Refresh now. Tools for package owners.