11 Star 46 Fork 0

Gitee 极速下载 / consul

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/hashicorp/consul
克隆/下载
stop_context.go 732 Bytes
一键复制 编辑 原始数据 按行查看 历史
package lib
import (
"context"
"time"
)
// StopChannelContext implements the context.Context interface
// You provide the channel to select on to determine whether
// the context should be canceled and other code such
// as the rate.Limiter will automatically use the channel
// appropriately
type StopChannelContext struct {
StopCh <-chan struct{}
}
func (c *StopChannelContext) Deadline() (deadline time.Time, ok bool) {
ok = false
return
}
func (c *StopChannelContext) Done() <-chan struct{} {
return c.StopCh
}
func (c *StopChannelContext) Err() error {
select {
case <-c.StopCh:
return context.Canceled
default:
return nil
}
}
func (c *StopChannelContext) Value(key interface{}) interface{} {
return nil
}
1
https://gitee.com/mirrors/consul.git
git@gitee.com:mirrors/consul.git
mirrors
consul
consul
v1.4.5

搜索帮助