Documentation ¶
Overview ¶
Package etcdx - an extension of etcd library.
Index ¶
- Constants
- func Get[T any](key string) (ret T, _ error)
- func GetAllAsMap[T any](prefix string) (map[string]*T, error)
- func GetBytes(key string) ([]byte, error)
- func GetKeys(prefix string) ([]string, error)
- func Grant(ttl int64) (int64, error)
- func KeepaliveOnce(lease int64) error
- func NewClient(cfg *Config) (*etcd.Client, error)
- func Put(key, value string) error
- func PutWithLease(key, value string, lease int64) error
- func PutWithNewLease(key, value string, ttl int64) (int64, error)
- func Revoke(lease int64) error
- type Config
- type KV
Constants ¶
View Source
const ( KeyEndpoints = "server.etcd.endpoints" KeyDialTimeout = "server.etcd.dial.timeout" KeyReadTimeout = "server.etcd.read.timeout" KeyWriteTimeout = "server.etcd.write.timeout" )
Variables ¶
This section is empty.
Functions ¶
func GetAllAsMap ¶ added in v0.0.13
GetAllAsMap - retrieves all KVs matches given prefix and converts to a map[<key>]<value>.
func GetKeys ¶
GetKeys - retrieves all keys with given prefix in etcd clusters. Caution: a very short prefix can match a large mount of keys. Please use this function carefully.
func KeepaliveOnce ¶
KeepaliveOnce - sends keepalive (heartbeat) message to etcd server only once.
func PutWithLease ¶
PutWithLease - writes a KV to etcd with given lease ID.
func PutWithNewLease ¶ added in v0.0.7
PutWithNewLease - writes a KV to etcd with a new granted lease and returns the lease id to caller. The new generated lease will be revoked if errors occurred.
Types ¶
type Config ¶
Click to show internal directories.
Click to hide internal directories.