Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Blocker ¶
type Blocker struct {
// contains filtered or unexported fields
}
Blocker provides a function which can block some process. Unblock strategy bases on Priority. The higher the priority, the earlier it will be unblocked. Unblocking is done by consuming tickets. If ticket chan is nil when new a Blocker, Blocker will keep printing tickets itself.
func NewBlocker ¶
func NewBlocker(ticketChan <-chan struct{}) *Blocker
NewBlocker create a new Blocker instance.
func (*Blocker) Block ¶
Block the process, until a ticket with the priority of the flag consumed.
func (*Blocker) GetPriority ¶
GetPriority query the priority of the flag. If never set, will return PriorityLevel5.
type Priority ¶
type Priority uint8
Priority for blocking with blocker.
const ( // PriorityLevel0 level0 PriorityLevel0 Priority = iota // PriorityLevel1 level1 PriorityLevel1 // PriorityLevel2 level2 PriorityLevel2 // PriorityLevel3 level3 PriorityLevel3 // PriorityLevel4 level4 PriorityLevel4 // PriorityLevel5 level5 PriorityLevel5 // PriorityLevel6 level6 PriorityLevel6 // PriorityLevel7 level7 PriorityLevel7 // PriorityLevel8 level8 PriorityLevel8 // PriorityLevel9 level9 PriorityLevel9 )
Click to show internal directories.
Click to hide internal directories.