github.com/haraldrudell/parl@v0.4.176/cb-reason.go (about) 1 /* 2 © 2022–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/) 3 ISC License 4 */ 5 6 package parl 7 8 import "github.com/haraldrudell/parl/sets" 9 10 const ( 11 // [parl.InvocationTimer] callback due to increased parallelism 12 ITParallelism CBReason = iota + 1 13 // [parl.InvocationTimer] callback due to increased latency 14 ITLatency 15 ) 16 17 // CBReason explains to consumer why [parl.InvocationTimer] invoked the callback 18 // - ITParallelism ITLatency 19 type CBReason uint8 20 21 func (r CBReason) String() (s string) { 22 return cbReasonSet.StringT(r) 23 } 24 25 // cbReasonSet translates CBReason to string 26 var cbReasonSet = sets.NewSet[CBReason]([]sets.SetElement[CBReason]{ 27 {ValueV: ITParallelism, Name: "max parallel"}, 28 {ValueV: ITLatency, Name: "slowest"}, 29 })