etcdclient

package
v0.0.0-...-39cfe40 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoggedClose

func LoggedClose(etcdClient *EtcdClient)

LoggedClose closes the etcdclient, warning on error

Types

type EtcdClient

type EtcdClient struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(endpoints []string, tlsConfig *tls.Config) (*EtcdClient, error)

func (*EtcdClient) AddMember

func (c *EtcdClient) AddMember(ctx context.Context, peerURLs []string) error

func (*EtcdClient) Close

func (c *EtcdClient) Close() error

func (*EtcdClient) CopyTo

func (c *EtcdClient) CopyTo(ctx context.Context, dest NodeSink) (int, error)

func (*EtcdClient) Create

func (c *EtcdClient) Create(ctx context.Context, key string, value []byte) error

func (*EtcdClient) Get

func (c *EtcdClient) Get(ctx context.Context, key string, quorum bool, timeout time.Duration) ([]byte, error)

func (*EtcdClient) LeaderID

func (c *EtcdClient) LeaderID(ctx context.Context) (string, error)

func (*EtcdClient) ListMembers

func (c *EtcdClient) ListMembers(ctx context.Context) ([]*EtcdProcessMember, error)

func (*EtcdClient) LocalNodeInfo

func (c *EtcdClient) LocalNodeInfo(ctx context.Context) (*LocalNodeInfo, error)

func (*EtcdClient) Put

func (c *EtcdClient) Put(ctx context.Context, key string, value []byte) error

func (*EtcdClient) RemoveMember

func (c *EtcdClient) RemoveMember(ctx context.Context, member *EtcdProcessMember) error

func (*EtcdClient) ServerVersion

func (c *EtcdClient) ServerVersion(ctx context.Context) (string, error)

ServerVersion returns the version of etcd running

func (*EtcdClient) SetPeerURLs

func (c *EtcdClient) SetPeerURLs(ctx context.Context, member *EtcdProcessMember, peerURLs []string) error

func (*EtcdClient) SnapshotSave

func (c *EtcdClient) SnapshotSave(ctx context.Context, path string) error

func (*EtcdClient) String

func (c *EtcdClient) String() string

type EtcdProcessMember

type EtcdProcessMember struct {
	//Id         string   `json:"id,omitempty"`
	Name     string   `json:"name,omitempty"`
	PeerURLs []string `json:"peerURLs,omitempty"`
	// ClientURLs is the set of URLs as reported by the cluster.
	// Note that it might be incorrect, because the ClientURLs are stored in Raft, but can be reconfigured from the command line
	ClientURLs []string `json:"endpoints,omitempty"`

	ID string
	// contains filtered or unexported fields
}

func (*EtcdProcessMember) NewClient

func (m *EtcdProcessMember) NewClient(clientURLs []string, tlsConfig *tls.Config) (*EtcdClient, error)

func (*EtcdProcessMember) String

func (m *EtcdProcessMember) String() string

type LocalNodeInfo

type LocalNodeInfo struct {
	IsLeader bool
}

LocalNodeInfo has information about the etcd member node we are connected to

type NodeSink

type NodeSink interface {
	io.Closer

	Put(ctx context.Context, key string, value []byte) error
}

NodeSink is implemented by a target for CopyTo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL