Documentation ¶
Index ¶
- func GetCacheBucket(ns string) *gcache.Cache
- type Cache
- type CancelMessage
- type ConditionGroup
- func (cg *ConditionGroup) Cancel(nvs ...interface{})
- func (cg *ConditionGroup) Inspect(name interface{}) (interface{}, *CancelMessage, bool)
- func (cg *ConditionGroup) Require(name interface{}) interface{}
- func (cg *ConditionGroup) Satisfy(nvs ...interface{})
- func (cg *ConditionGroup) Want(name interface{}) (interface{}, *CancelMessage)
- type ConditionTask
- type Sudu
- type TaskGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCacheBucket ¶
Types ¶
type CancelMessage ¶
type CancelMessage struct {
Message interface{}
}
type ConditionGroup ¶
type ConditionGroup struct {
// contains filtered or unexported fields
}
条件依赖模型 有点类似于pub/sub模型 但对于条件而言,只有满足与不满足 条件满足后,所有对该条件的引用全部不会阻塞,且一定成功,不用像pub/sub模型中先行订阅
func NewConditionGroup ¶
func NewConditionGroup() *ConditionGroup
func (*ConditionGroup) Cancel ¶
func (cg *ConditionGroup) Cancel(nvs ...interface{})
name, msg, [name, msg, ...]
func (*ConditionGroup) Inspect ¶
func (cg *ConditionGroup) Inspect(name interface{}) (interface{}, *CancelMessage, bool)
read from raw map
func (*ConditionGroup) Require ¶
func (cg *ConditionGroup) Require(name interface{}) interface{}
got or panic
func (*ConditionGroup) Satisfy ¶
func (cg *ConditionGroup) Satisfy(nvs ...interface{})
name, value, [name, value, ...]
func (*ConditionGroup) Want ¶
func (cg *ConditionGroup) Want(name interface{}) (interface{}, *CancelMessage)
raw map first, otherwise waiting for Satisfy()
type ConditionTask ¶
type ConditionTask struct { ConditionGroup TaskGroup }
快速组合 sudu的一种简单的降级使用方式 不涉及条件的legacy状态变更问题 所有条件只区分有和没有 可以尽最大努力在满足条件的前提下进行任务并发
func NewConditionTask ¶
func NewConditionTask() *ConditionTask
type Sudu ¶
type Sudu struct { ConditionGroup Tasks int Running int WaitAll bool // contains filtered or unexported fields }
Sudu,用于将存在条件依赖的并发调用,利用cache机制将依赖解开,变成并发调用 核心需要处理的,则是依赖条件值的legacy问题 使用legacy的值抢先进行预测,当依赖的条件由legacy状态转变为unlegacy时 对应抢先预测的任务需要检查自身刚做完的结果是否有必要重做 自身是否也受到unlegacy影响,也应当转变为unlegacy状态
func (*Sudu) Conditions ¶
func (sd *Sudu) Conditions() []interface{}
func (*Sudu) Go ¶
func (sd *Sudu) Go(fxs ...func(*ConditionGroup))
func (*Sudu) SatisfyLegacy ¶
func (sd *Sudu) SatisfyLegacy(nvs ...interface{})
name, value, [name, value, ...]
type TaskGroup ¶
type TaskGroup struct { Tasks int Running int WaitAll bool // contains filtered or unexported fields }
一个waitgroup的高级封装
func NewTaskGroup ¶
func NewTaskGroup() *TaskGroup
Click to show internal directories.
Click to hide internal directories.