Versions in this module Expand all Collapse all v1 v1.0.1 Jan 10, 2021 v1.0.0 Jan 10, 2021 Changes in this version + const ErrorCodeDirNotEmpty + const ErrorCodeEventIndexCleared + const ErrorCodeIndexNaN + const ErrorCodeInvalidField + const ErrorCodeInvalidForm + const ErrorCodeKeyNotFound + const ErrorCodeLeaderElect + const ErrorCodeNodeExist + const ErrorCodeNotDir + const ErrorCodeNotFile + const ErrorCodePrevValueRequired + const ErrorCodeRaftInternal + const ErrorCodeRootROnly + const ErrorCodeTTLNaN + const ErrorCodeTestFailed + const ErrorCodeUnauthorized + const ErrorCodeWatcherCleared + const PrevExist + const PrevIgnore + const PrevNoExist + var DefaultRequestTimeout = 5 * time.Second + var ErrClusterUnavailable = errors.New("client: etcd cluster is unavailable or misconfigured") + var ErrEmptyBody = errors.New("client: response body is empty") + var ErrInvalidJSON = errors.New(...) + var ErrNoEndpoints = errors.New("client: no endpoints available") + var ErrNoLeaderEndpoint = errors.New("client: no leader endpoint available") + var ErrTooManyRedirects = errors.New("client: too many redirects") + func DisablecURLDebug() + func EnablecURLDebug() + func IsKeyNotFound(err error) bool + func IsRoleNotFound(err error) bool + func IsUserNotFound(err error) bool + type AuthAPI interface + Disable func(ctx context.Context) error + Enable func(ctx context.Context) error + func NewAuthAPI(c Client) AuthAPI + type AuthRoleAPI interface + AddRole func(ctx context.Context, role string) error + GetRole func(ctx context.Context, role string) (*Role, error) + GrantRoleKV func(ctx context.Context, role string, prefixes []string, permType PermissionType) (*Role, error) + ListRoles func(ctx context.Context) ([]string, error) + RemoveRole func(ctx context.Context, role string) error + RevokeRoleKV func(ctx context.Context, role string, prefixes []string, permType PermissionType) (*Role, error) + func NewAuthRoleAPI(c Client) AuthRoleAPI + type AuthUserAPI interface + AddUser func(ctx context.Context, username string, password string) error + ChangePassword func(ctx context.Context, username string, password string) (*User, error) + GetUser func(ctx context.Context, username string) (*User, error) + GrantUser func(ctx context.Context, username string, roles []string) (*User, error) + ListUsers func(ctx context.Context) ([]string, error) + RemoveUser func(ctx context.Context, username string) error + RevokeUser func(ctx context.Context, username string, roles []string) (*User, error) + func NewAuthUserAPI(c Client) AuthUserAPI + type CancelableTransport interface + CancelRequest func(req *http.Request) + var DefaultTransport CancelableTransport = &http.Transport{ ... } + type CheckRedirectFunc func(via int) error + var DefaultCheckRedirect CheckRedirectFunc = func(via int) error { ... } + type Client interface + AutoSync func(context.Context, time.Duration) error + Endpoints func() []string + GetVersion func(ctx context.Context) (*version.Versions, error) + SetEndpoints func(eps []string) error + Sync func(context.Context) error + func New(cfg Config) (Client, error) + type ClusterError struct + Errors []error + func (ce *ClusterError) Detail() string + func (ce *ClusterError) Error() string + type Config struct + CheckRedirect CheckRedirectFunc + Endpoints []string + HeaderTimeoutPerRequest time.Duration + Password string + SelectionMode EndpointSelectionMode + Transport CancelableTransport + Username string + type CreateInOrderOptions struct + TTL time.Duration + func (x *CreateInOrderOptions) CodecDecodeSelf(d *codec1978.Decoder) + func (x *CreateInOrderOptions) CodecEncodeSelf(e *codec1978.Encoder) + type DeleteOptions struct + Dir bool + PrevIndex uint64 + PrevValue string + Recursive bool + func (x *DeleteOptions) CodecDecodeSelf(d *codec1978.Decoder) + func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) + type Discoverer interface + Discover func(domain string) ([]string, error) + func NewSRVDiscover() Discoverer + type EndpointSelectionMode int + const EndpointSelectionPrioritizeLeader + const EndpointSelectionRandom + type Error struct + Cause string + Code int + Index uint64 + Message string + func (e Error) Error() string + func (x *Error) CodecDecodeSelf(d *codec1978.Decoder) + func (x *Error) CodecEncodeSelf(e *codec1978.Encoder) + type GetOptions struct + Quorum bool + Recursive bool + Sort bool + func (x *GetOptions) CodecDecodeSelf(d *codec1978.Decoder) + func (x *GetOptions) CodecEncodeSelf(e *codec1978.Encoder) + type KeysAPI interface + Create func(ctx context.Context, key, value string) (*Response, error) + CreateInOrder func(ctx context.Context, dir, value string, opts *CreateInOrderOptions) (*Response, error) + Delete func(ctx context.Context, key string, opts *DeleteOptions) (*Response, error) + Get func(ctx context.Context, key string, opts *GetOptions) (*Response, error) + Set func(ctx context.Context, key, value string, opts *SetOptions) (*Response, error) + Update func(ctx context.Context, key, value string) (*Response, error) + Watcher func(key string, opts *WatcherOptions) Watcher + func NewKeysAPI(c Client) KeysAPI + func NewKeysAPIWithPrefix(c Client, p string) KeysAPI + type Member struct + ClientURLs []string + ID string + Name string + PeerURLs []string + type MembersAPI interface + Add func(ctx context.Context, peerURL string) (*Member, error) + Leader func(ctx context.Context) (*Member, error) + List func(ctx context.Context) ([]Member, error) + Remove func(ctx context.Context, mID string) error + Update func(ctx context.Context, mID string, peerURLs []string) error + func NewMembersAPI(c Client) MembersAPI + type Node struct + CreatedIndex uint64 + Dir bool + Expiration *time.Time + Key string + ModifiedIndex uint64 + Nodes Nodes + TTL int64 + Value string + func (n *Node) String() string + func (n *Node) TTLDuration() time.Duration + func (x *Node) CodecDecodeSelf(d *codec1978.Decoder) + func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) + type Nodes []*Node + func (ns Nodes) Len() int + func (ns Nodes) Less(i, j int) bool + func (ns Nodes) Swap(i, j int) + func (x *Nodes) CodecDecodeSelf(d *codec1978.Decoder) + func (x Nodes) CodecEncodeSelf(e *codec1978.Encoder) + type PermissionType int + const ReadPermission + const ReadWritePermission + const WritePermission + type Permissions struct + KV rwPermission + type PrevExistType string + func (x *PrevExistType) CodecDecodeSelf(d *codec1978.Decoder) + func (x PrevExistType) CodecEncodeSelf(e *codec1978.Encoder) + type Response struct + Action string + ClusterID string + Index uint64 + Node *Node + PrevNode *Node + func (x *Response) CodecDecodeSelf(d *codec1978.Decoder) + func (x *Response) CodecEncodeSelf(e *codec1978.Encoder) + type Role struct + Grant *Permissions + Permissions Permissions + Revoke *Permissions + Role string + type SetOptions struct + Dir bool + NoValueOnSuccess bool + PrevExist PrevExistType + PrevIndex uint64 + PrevValue string + Refresh bool + TTL time.Duration + func (x *SetOptions) CodecDecodeSelf(d *codec1978.Decoder) + func (x *SetOptions) CodecEncodeSelf(e *codec1978.Encoder) + type User struct + Grant []string + Password string + Revoke []string + Roles []string + User string + type UserRoles struct + Roles []Role + User string + type Watcher interface + Next func(context.Context) (*Response, error) + type WatcherOptions struct + AfterIndex uint64 + Recursive bool + func (x *WatcherOptions) CodecDecodeSelf(d *codec1978.Decoder) + func (x *WatcherOptions) CodecEncodeSelf(e *codec1978.Encoder)