MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / next

Method next

pkg/rules/sequence.go:394–411  ·  view source on GitHub ↗

next determines whether the next expression in the sequence should be evaluated. The expression is evaluated if all its upstream sequence expression produced a match and the sequence is not stuck in deadline or expired state.

(seqID int)

Source from the content-addressed store, hash-verified

392// if all its upstream sequence expression produced a match and
393// the sequence is not stuck in deadline or expired state.
394func (s *sequenceState) next(seqID int) bool {
395 // always evaluate the first expression in the sequence
396 if seqID == 0 {
397 return true
398 }
399
400 var next bool
401 s.smu.RLock()
402 defer s.smu.RUnlock()
403 for n := range seqID {
404 next = s.states[n]
405 if !next {
406 break
407 }
408 }
409
410 return next && !s.inDeadline.Load() && !s.inExpired.Load()
411}
412
413func (s *sequenceState) scheduleMaxSpanDeadline(seqID fsm.State, maxSpan time.Duration) {
414 t := time.AfterFunc(maxSpan, func() {

Callers 2

runSequenceMethod · 0.95
TestSequenceStateFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestSequenceStateFunction · 0.64