3 Star 2 Fork 0

info-superbahn-ict / superbahn

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
assume.go 803 Bytes
一键复制 编辑 原始数据 按行查看 历史
tangshibo 提交于 2021-12-20 18:44 . update
package etcd_cli
import (
"context"
"github.com/coreos/etcd/clientv3"
)
type writeAssume struct {
cli *clientv3.Client
key string
value string
done bool
}
func (r *writeAssume) Done() uint64 {
if r.done {
return 0
}
_ ,_ = r.cli.Put(context.Background(),r.key,r.value)
r.done = true
return 1
}
func (r *writeAssume) Cancel() {
if r.done {
return
}
r.done = true
}
type deleteAssume struct {
cli *clientv3.Client
key string
done bool
}
func (r *deleteAssume) Done() uint64 {
if r.done {
return 0
}
_ ,_ = r.cli.Delete(context.Background(),r.key)
r.done = true
return 1
}
func (r *deleteAssume) Cancel() {
if r.done {
return
}
r.done = true
}
type testAssume struct {
}
func (r *testAssume) Done() uint64 {
return 1
}
func (r *testAssume) Cancel() {
}
Go
1
https://gitee.com/info-superbahn-ict/superbahn.git
git@gitee.com:info-superbahn-ict/superbahn.git
info-superbahn-ict
superbahn
superbahn
5fda629dab96

搜索帮助