Trigger represents an active trigger logic. Use NewTrigger() to create a trigger
| 70 | // Trigger represents an active trigger logic. Use NewTrigger() to create a |
| 71 | // trigger |
| 72 | type Trigger struct { |
| 73 | // protect mutual access of 'trigger' between Trigger() and waiter() |
| 74 | mutex lock.Mutex |
| 75 | trigger bool |
| 76 | |
| 77 | // params are the user specified parameters |
| 78 | params Parameters |
| 79 | |
| 80 | // lastTrigger is the timestamp of the last invoked trigger |
| 81 | lastTrigger time.Time |
| 82 | |
| 83 | // wakeupCan is used to wake up the background trigger routine |
| 84 | wakeupChan chan struct{} |
| 85 | |
| 86 | // closeChan is used to stop the background trigger routine |
| 87 | closeChan chan struct{} |
| 88 | |
| 89 | // numFolds is the current count of folds that happened into the |
| 90 | // currently scheduled trigger |
| 91 | numFolds int |
| 92 | |
| 93 | // foldedReasons is the sum of all unique reasons folded together. |
| 94 | foldedReasons reasonStack |
| 95 | |
| 96 | waitStart time.Time |
| 97 | } |
| 98 | |
| 99 | // NewTrigger returns a new trigger based on the provided parameters |
| 100 | func NewTrigger(p Parameters) (*Trigger, error) { |
nothing calls this directly
no outgoing calls
no test coverage detected