Versions in this module Expand all Collapse all v3 v3.4.4 Mar 18, 2020 Changes in this version + const EventTypeDelete + const EventTypePut + const MaxLeaseTTL + const PermRead + const PermReadWrite + const PermWrite + var ErrNoAvailableEndpoints = errors.New("etcdclient: no available endpoints") + var ErrOldCluster = errors.New("etcdclient: old cluster version") + var LeaseResponseChSize = 16 + func GetLogger() logutil.Logger + func GetPrefixRangeEnd(prefix string) string + func IsConnCanceled(err error) bool + func NewLogger(gl grpclog.LoggerV2) logutil.Logger + func RetryAuthClient(c *Client) pb.AuthClient + func RetryClusterClient(c *Client) pb.ClusterClient + func RetryKVClient(c *Client) pb.KVClient + func RetryLeaseClient(c *Client) pb.LeaseClient + func RetryMaintenanceClient(c *Client, conn *grpc.ClientConn) pb.MaintenanceClient + func SetLogger(l grpclog.LoggerV2) + func WithRequireLeader(ctx context.Context) context.Context + type AlarmMember pb.AlarmMember + type AlarmResponse pb.AlarmResponse + type Auth interface + AuthDisable func(ctx context.Context) (*AuthDisableResponse, error) + AuthEnable func(ctx context.Context) (*AuthEnableResponse, error) + RoleAdd func(ctx context.Context, name string) (*AuthRoleAddResponse, error) + RoleDelete func(ctx context.Context, role string) (*AuthRoleDeleteResponse, error) + RoleGet func(ctx context.Context, role string) (*AuthRoleGetResponse, error) + RoleGrantPermission func(ctx context.Context, name string, key, rangeEnd string, ...) (*AuthRoleGrantPermissionResponse, error) + RoleList func(ctx context.Context) (*AuthRoleListResponse, error) + RoleRevokePermission func(ctx context.Context, role string, key, rangeEnd string) (*AuthRoleRevokePermissionResponse, error) + UserAdd func(ctx context.Context, name string, password string) (*AuthUserAddResponse, error) + UserAddWithOptions func(ctx context.Context, name string, password string, opt *UserAddOptions) (*AuthUserAddResponse, error) + UserChangePassword func(ctx context.Context, name string, password string) (*AuthUserChangePasswordResponse, error) + UserDelete func(ctx context.Context, name string) (*AuthUserDeleteResponse, error) + UserGet func(ctx context.Context, name string) (*AuthUserGetResponse, error) + UserGrantRole func(ctx context.Context, user string, role string) (*AuthUserGrantRoleResponse, error) + UserList func(ctx context.Context) (*AuthUserListResponse, error) + UserRevokeRole func(ctx context.Context, name string, role string) (*AuthUserRevokeRoleResponse, error) + func NewAuth(c *Client) Auth + type AuthDisableResponse pb.AuthDisableResponse + type AuthEnableResponse pb.AuthEnableResponse + type AuthRoleAddResponse pb.AuthRoleAddResponse + type AuthRoleDeleteResponse pb.AuthRoleDeleteResponse + type AuthRoleGetResponse pb.AuthRoleGetResponse + type AuthRoleGrantPermissionResponse pb.AuthRoleGrantPermissionResponse + type AuthRoleListResponse pb.AuthRoleListResponse + type AuthRoleRevokePermissionResponse pb.AuthRoleRevokePermissionResponse + type AuthUserAddResponse pb.AuthUserAddResponse + type AuthUserChangePasswordResponse pb.AuthUserChangePasswordResponse + type AuthUserDeleteResponse pb.AuthUserDeleteResponse + type AuthUserGetResponse pb.AuthUserGetResponse + type AuthUserGrantRoleResponse pb.AuthUserGrantRoleResponse + type AuthUserListResponse pb.AuthUserListResponse + type AuthUserRevokeRoleResponse pb.AuthUserRevokeRoleResponse + type AuthenticateResponse pb.AuthenticateResponse + type Client struct + Password string + Username string + func New(cfg Config) (*Client, error) + func NewCtxClient(ctx context.Context) *Client + func NewFromURL(url string) (*Client, error) + func NewFromURLs(urls []string) (*Client, error) + func (c *Client) ActiveConnection() *grpc.ClientConn + func (c *Client) Close() error + func (c *Client) Ctx() context.Context + func (c *Client) Dial(ep string) (*grpc.ClientConn, error) + func (c *Client) Endpoints() []string + func (c *Client) SetEndpoints(eps ...string) + func (c *Client) Sync(ctx context.Context) error + type Cluster interface + MemberAdd func(ctx context.Context, peerAddrs []string) (*MemberAddResponse, error) + MemberAddAsLearner func(ctx context.Context, peerAddrs []string) (*MemberAddResponse, error) + MemberList func(ctx context.Context) (*MemberListResponse, error) + MemberPromote func(ctx context.Context, id uint64) (*MemberPromoteResponse, error) + MemberRemove func(ctx context.Context, id uint64) (*MemberRemoveResponse, error) + MemberUpdate func(ctx context.Context, id uint64, peerAddrs []string) (*MemberUpdateResponse, error) + func NewCluster(c *Client) Cluster + func NewClusterFromClusterClient(remote pb.ClusterClient, c *Client) Cluster + type Cmp pb.Compare + func Compare(cmp Cmp, result string, v interface{}) Cmp + func CreateRevision(key string) Cmp + func LeaseValue(key string) Cmp + func ModRevision(key string) Cmp + func Value(key string) Cmp + func Version(key string) Cmp + func (cmp *Cmp) KeyBytes() []byte + func (cmp *Cmp) ValueBytes() []byte + func (cmp *Cmp) WithKeyBytes(key []byte) + func (cmp *Cmp) WithValueBytes(v []byte) + func (cmp Cmp) WithPrefix() Cmp + func (cmp Cmp) WithRange(end string) Cmp + type CompactOp struct + func OpCompact(rev int64, opts ...CompactOption) CompactOp + type CompactOption func(*CompactOp) + func WithCompactPhysical() CompactOption + type CompactResponse pb.CompactionResponse + type CompareResult int + type CompareTarget int + const CompareCreated + const CompareModified + const CompareValue + const CompareVersion + type Config struct + AutoSyncInterval time.Duration + Context context.Context + DialKeepAliveTime time.Duration + DialKeepAliveTimeout time.Duration + DialOptions []grpc.DialOption + DialTimeout time.Duration + Endpoints []string + LogConfig *zap.Config + MaxCallRecvMsgSize int + MaxCallSendMsgSize int + Password string + PermitWithoutStream bool + RejectOldCluster bool + TLS *tls.Config + Username string + type DefragmentResponse pb.DefragmentResponse + type DeleteResponse pb.DeleteRangeResponse + func (resp *DeleteResponse) OpResponse() OpResponse + type ErrKeepAliveHalted struct + Reason error + func (e ErrKeepAliveHalted) Error() string + type Event mvccpb.Event + func (e *Event) IsCreate() bool + func (e *Event) IsModify() bool + type GetResponse pb.RangeResponse + func (resp *GetResponse) OpResponse() OpResponse + type HashKVResponse pb.HashKVResponse + type KV interface + Compact func(ctx context.Context, rev int64, opts ...CompactOption) (*CompactResponse, error) + Delete func(ctx context.Context, key string, opts ...OpOption) (*DeleteResponse, error) + Do func(ctx context.Context, op Op) (OpResponse, error) + Get func(ctx context.Context, key string, opts ...OpOption) (*GetResponse, error) + Put func(ctx context.Context, key, val string, opts ...OpOption) (*PutResponse, error) + Txn func(ctx context.Context) Txn + func NewKV(c *Client) KV + func NewKVFromKVClient(remote pb.KVClient, c *Client) KV + type Lease interface + Close func() error + Grant func(ctx context.Context, ttl int64) (*LeaseGrantResponse, error) + KeepAlive func(ctx context.Context, id LeaseID) (<-chan *LeaseKeepAliveResponse, error) + KeepAliveOnce func(ctx context.Context, id LeaseID) (*LeaseKeepAliveResponse, error) + Leases func(ctx context.Context) (*LeaseLeasesResponse, error) + Revoke func(ctx context.Context, id LeaseID) (*LeaseRevokeResponse, error) + TimeToLive func(ctx context.Context, id LeaseID, opts ...LeaseOption) (*LeaseTimeToLiveResponse, error) + func NewLease(c *Client) Lease + func NewLeaseFromLeaseClient(remote pb.LeaseClient, c *Client, keepAliveTimeout time.Duration) Lease + type LeaseGrantResponse struct + Error string + ID LeaseID + TTL int64 + type LeaseID int64 + const NoLease + type LeaseKeepAliveResponse struct + ID LeaseID + TTL int64 + type LeaseLeasesResponse struct + Leases []LeaseStatus + type LeaseOp struct + type LeaseOption func(*LeaseOp) + func WithAttachedKeys() LeaseOption + type LeaseRevokeResponse pb.LeaseRevokeResponse + type LeaseStatus struct + ID LeaseID + type LeaseTimeToLiveResponse struct + GrantedTTL int64 + ID LeaseID + Keys [][]byte + TTL int64 + type Maintenance interface + AlarmDisarm func(ctx context.Context, m *AlarmMember) (*AlarmResponse, error) + AlarmList func(ctx context.Context) (*AlarmResponse, error) + Defragment func(ctx context.Context, endpoint string) (*DefragmentResponse, error) + HashKV func(ctx context.Context, endpoint string, rev int64) (*HashKVResponse, error) + MoveLeader func(ctx context.Context, transfereeID uint64) (*MoveLeaderResponse, error) + Snapshot func(ctx context.Context) (io.ReadCloser, error) + Status func(ctx context.Context, endpoint string) (*StatusResponse, error) + func NewMaintenance(c *Client) Maintenance + func NewMaintenanceFromMaintenanceClient(remote pb.MaintenanceClient, c *Client) Maintenance + type Member pb.Member + type MemberAddResponse pb.MemberAddResponse + type MemberListResponse pb.MemberListResponse + type MemberPromoteResponse pb.MemberPromoteResponse + type MemberRemoveResponse pb.MemberRemoveResponse + type MemberUpdateResponse pb.MemberUpdateResponse + type MoveLeaderResponse pb.MoveLeaderResponse + type Op struct + func OpDelete(key string, opts ...OpOption) Op + func OpGet(key string, opts ...OpOption) Op + func OpPut(key, val string, opts ...OpOption) Op + func OpTxn(cmps []Cmp, thenOps []Op, elseOps []Op) Op + func (op *Op) WithKeyBytes(key []byte) + func (op *Op) WithRangeBytes(end []byte) + func (op *Op) WithValueBytes(v []byte) + func (op Op) IsCountOnly() bool + func (op Op) IsDelete() bool + func (op Op) IsGet() bool + func (op Op) IsKeysOnly() bool + func (op Op) IsPut() bool + func (op Op) IsSerializable() bool + func (op Op) IsTxn() bool + func (op Op) KeyBytes() []byte + func (op Op) MaxCreateRev() int64 + func (op Op) MaxModRev() int64 + func (op Op) MinCreateRev() int64 + func (op Op) MinModRev() int64 + func (op Op) RangeBytes() []byte + func (op Op) Rev() int64 + func (op Op) Txn() ([]Cmp, []Op, []Op) + func (op Op) ValueBytes() []byte + type OpOption func(*Op) + func WithCountOnly() OpOption + func WithCreatedNotify() OpOption + func WithFilterDelete() OpOption + func WithFilterPut() OpOption + func WithFirstCreate() []OpOption + func WithFirstKey() []OpOption + func WithFirstRev() []OpOption + func WithFragment() OpOption + func WithFromKey() OpOption + func WithIgnoreLease() OpOption + func WithIgnoreValue() OpOption + func WithKeysOnly() OpOption + func WithLastCreate() []OpOption + func WithLastKey() []OpOption + func WithLastRev() []OpOption + func WithLease(leaseID LeaseID) OpOption + func WithLimit(n int64) OpOption + func WithMaxCreateRev(rev int64) OpOption + func WithMaxModRev(rev int64) OpOption + func WithMinCreateRev(rev int64) OpOption + func WithMinModRev(rev int64) OpOption + func WithPrefix() OpOption + func WithPrevKV() OpOption + func WithProgressNotify() OpOption + func WithRange(endKey string) OpOption + func WithRev(rev int64) OpOption + func WithSerializable() OpOption + func WithSort(target SortTarget, order SortOrder) OpOption + type OpResponse struct + func (op OpResponse) Del() *DeleteResponse + func (op OpResponse) Get() *GetResponse + func (op OpResponse) Put() *PutResponse + func (op OpResponse) Txn() *TxnResponse + type Permission authpb.Permission + type PermissionType authpb.Permission_Type + func StrToPermissionType(s string) (PermissionType, error) + type PutResponse pb.PutResponse + func (resp *PutResponse) OpResponse() OpResponse + type SortOption struct + Order SortOrder + Target SortTarget + type SortOrder int + const SortAscend + const SortDescend + const SortNone + type SortTarget int + const SortByCreateRevision + const SortByKey + const SortByModRevision + const SortByValue + const SortByVersion + type StatusResponse pb.StatusResponse + type TransportCredentialsWithDialer interface + Dialer func(ctx context.Context, dialEp string) (net.Conn, error) + type Txn interface + Commit func() (*TxnResponse, error) + Else func(ops ...Op) Txn + If func(cs ...Cmp) Txn + Then func(ops ...Op) Txn + type TxnResponse pb.TxnResponse + func (resp *TxnResponse) OpResponse() OpResponse + type UserAddOptions authpb.UserAddOptions + type WatchChan <-chan WatchResponse + type WatchResponse struct + Canceled bool + CompactRevision int64 + Created bool + Events []*Event + Header pb.ResponseHeader + func (wr *WatchResponse) Err() error + func (wr *WatchResponse) IsProgressNotify() bool + type Watcher interface + Close func() error + RequestProgress func(ctx context.Context) error + Watch func(ctx context.Context, key string, opts ...OpOption) WatchChan + func NewWatchFromWatchClient(wc pb.WatchClient, c *Client) Watcher + func NewWatcher(c *Client) Watcher