Documentation ¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) BatchCreate(kList []string, vList []string) error
- func (c *Client) CleanKV() error
- func (c *Client) Close()
- func (c *Client) Create(k string, v string) error
- func (c *Client) Delete(k string) error
- func (c *Client) Done() <-chan struct{}
- func (c *Client) Get(k string) (string, error)
- func (c *Client) GetChildren(k string) ([]string, []string, error)
- func (c *Client) GetChildrenKVList(k string) ([]string, []string, error)
- func (c *Client) GetCtx() context.Context
- func (c *Client) GetEndPoints() []string
- func (c *Client) GetRawClient() *clientv3.Client
- func (c *Client) GetValAndRev(k string) (string, int64, error)
- func (c *Client) RegisterTemp(k, v string) error
- func (c *Client) Update(k, v string) error
- func (c *Client) UpdateWithRev(k, v string, rev int64, opts ...clientv3.OpOption) error
- func (c *Client) Valid() bool
- func (c *Client) Watch(k string) (clientv3.WatchChan, error)
- func (c *Client) WatchWithOption(k string, opts ...clientv3.OpOption) (clientv3.WatchChan, error)
- func (c *Client) WatchWithPrefix(prefix string) (clientv3.WatchChan, error)
- type Option
- type Options
Constants ¶
const ( // ConnDelay connection delay ConnDelay = 3 // MaxFailTimes max failure times MaxFailTimes = 15 // RegistryETCDV3Client client Name RegistryETCDV3Client = "etcd registry" // MetadataETCDV3Client client Name MetadataETCDV3Client = "etcd metadata" )
Variables ¶
var ( // ErrNilETCDV3Client raw client nil ErrNilETCDV3Client = perrors.New("etcd raw client is nil") // full describe the ERR // ErrKVPairNotFound not found key ErrKVPairNotFound = perrors.New("k/v pair not found") // ErrKVListSizeIllegal k/v list empty or not equal size ErrKVListSizeIllegal = perrors.New("k/v List is empty or kList's size is not equal to the size of vList") // ErrCompareFail txn compare fail ErrCompareFail = perrors.New("txn compare fail") // ErrRevision revision when error ErrRevision int64 = -1 )
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client represents etcd client Configuration
func NewClient ¶
func NewClient(name string, endpoints []string, timeout time.Duration, heartbeat int) (*Client, error)
NewClient create a client instance with name, endpoints etc.
func NewConfigClient ¶
NewConfigClient create new Client
func NewConfigClientWithErr ¶ added in v1.11.8
NewConfigClientWithErr create new Client,error
func (*Client) BatchCreate ¶ added in v1.11.8
BatchCreate bulk insertion
func (*Client) GetChildren ¶ added in v1.11.3
GetChildren return node children
func (*Client) GetChildrenKVList ¶
GetChildrenKVList gets children kv list by @k
func (*Client) GetEndPoints ¶ added in v1.11.3
GetEndPoints return etcd endpoints
func (*Client) GetRawClient ¶ added in v1.11.3
GetRawClient return etcd raw client
func (*Client) GetValAndRev ¶ added in v1.11.8
GetValAndRev gets value and revision by @k
func (*Client) RegisterTemp ¶
RegisterTemp registers a temporary node
func (*Client) UpdateWithRev ¶ added in v1.11.8
Update key value ...
func (*Client) WatchWithOption ¶ added in v1.11.8
Watch watches on spc key with OpOption
type Option ¶
type Option func(*Options)
Option will define a function of handling Options
func WithEndpoints ¶
WithEndpoints sets etcd client endpoints
func WithHeartbeat ¶
WithHeartbeat sets etcd client heartbeat
func WithTimeout ¶
WithTimeout sets etcd client timeout