You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
459 B
26 lines
459 B
package gojobs
|
|
|
|
import (
|
|
"go.etcd.io/etcd/client/v3"
|
|
"time"
|
|
)
|
|
|
|
// EtcdConfig etcd配置
|
|
type EtcdConfig struct {
|
|
Endpoints []string // 接口 []string{"http://127.0.0.1:2379"}
|
|
DialTimeout time.Duration // time.Second * 5
|
|
}
|
|
|
|
// Etcd etcd
|
|
type Etcd struct {
|
|
EtcdConfig // 配置
|
|
client *clientv3.Client // 驱动
|
|
kv clientv3.KV
|
|
lease clientv3.Lease
|
|
}
|
|
|
|
// Close 关闭
|
|
func (e Etcd) Close() {
|
|
e.client.Close()
|
|
}
|