当前仓库属于暂停状态,部分功能使用受限,详情请查阅 仓库状态说明
2 Star 0 Fork 1

JUMEI_ARCH/go-plugins
暂停

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
utils.go 1.08 KB
一键复制 编辑 原始数据 按行查看 历史
package mock
import (
"github.com/micro/go-plugins/registry/kubernetes/client"
"github.com/micro/go-plugins/registry/kubernetes/client/watch"
)
type mockWatcher struct {
results chan watch.Event
stop chan bool
}
// Changes returns the results channel
func (w *mockWatcher) ResultChan() <-chan watch.Event {
return w.results
}
// Stop closes any channels
func (w *mockWatcher) Stop() {
select {
case <-w.stop:
return
default:
close(w.stop)
close(w.results)
}
}
func updateMetadata(a, b *client.Meta) {
if a == nil || b == nil {
return
}
if b.Labels != nil {
for lk, lv := range b.Labels {
labels := a.Labels
if lv == nil {
delete(labels, lk)
continue
}
labels[lk] = lv
}
}
if b.Annotations != nil {
for ak, av := range b.Annotations {
ann := a.Annotations
if av == nil {
delete(ann, ak)
continue
}
ann[ak] = av
}
}
}
func labelFilterMatch(a map[string]*string, b map[string]string) bool {
match := true
for lk, lv := range b {
ml, ok := a[lk]
if !ok || *ml != lv {
match = false
break
}
}
return match
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/JMArch/go-plugins.git
git@gitee.com:JMArch/go-plugins.git
JMArch
go-plugins
go-plugins
v0.2.1

搜索帮助