Documentation ¶
Index ¶
- Constants
- Variables
- func Del(key string, opts ...clientv3.OpOption) error
- func ExecAllTask(key string, ttl int, task func()) error
- func ExecOnceTask(key string, ttl int, task func()) error
- func Get(key string, opts ...clientv3.OpOption) ([]*mvccpb.KeyValue, error)
- func New(e *Etcd) (*clientv3.Client, error)
- func Put(key, value string, opts ...clientv3.OpOption) error
- func PutWithLease(key, val string, ttl int64, opts ...clientv3.OpOption) error
- func Register(serverName, addr string, ttl int64) error
- func Unregister(serverName, addr string) error
- type Etcd
Constants ¶
View Source
const APP = "etcd"
Variables ¶
View Source
var Client *clientv3.Client
Functions ¶
func ExecAllTask ¶
ExecAllTask 基于分布式的全部执行任务
func ExecOnceTask ¶
ExecOnceTask 基于分布式的唯一执行任务
func Unregister ¶
Types ¶
type Etcd ¶
type Etcd struct { Nodes []string `mapstructure:"nodes" default:"" yaml:"nodes" json:"nodes"` Username string `mapstructure:"username" default:"" yaml:"username" json:"username"` Password string `mapstructure:"password" default:"" yaml:"password" json:"password"` Timeout int `mapstructure:"timeout" default:"10" yaml:"timeout" json:"timeout"` TTL int64 `mapstructure:"ttl" default:"10" yaml:"ttl" json:"ttl"` }
Click to show internal directories.
Click to hide internal directories.