evalSequence evaluates the sequence with one, multiple or no join links. The sequence link is first consulted for the global sequence definition, and if it is not defined then the expression sequence link is used.
( e *event.Event, seqID int, expr *ql.SequenceExpr, partials map[int][]*event.Event, valuer ql.MapValuer, )
| 341 | // global sequence definition, and if it is not defined then |
| 342 | // the expression sequence link is used. |
| 343 | func (f *filter) evalSequence( |
| 344 | e *event.Event, |
| 345 | seqID int, |
| 346 | expr *ql.SequenceExpr, |
| 347 | partials map[int][]*event.Event, |
| 348 | valuer ql.MapValuer, |
| 349 | ) bool { |
| 350 | // top-level sequence link is defined |
| 351 | by := f.seq.By |
| 352 | if by == nil { |
| 353 | // otherwise, use the expression link |
| 354 | by = expr.By |
| 355 | } |
| 356 | |
| 357 | var match bool |
| 358 | if seqID >= 1 && by != nil { |
| 359 | linkID := makeSequenceLinkID(valuer, by) |
| 360 | // traverse upstream partials for join equality |
| 361 | joins := make([]bool, seqID) |
| 362 | outer: |
| 363 | for i := range seqID { |
| 364 | for _, p := range partials[i] { |
| 365 | if CompareSeqLink(linkID, p.SequenceLinks()) { |
| 366 | joins[i] = true |
| 367 | continue outer |
| 368 | } |
| 369 | } |
| 370 | } |
| 371 | match = joinsEqual(joins) && ql.Eval(expr.Expr, valuer, f.hasFunctions) |
| 372 | } else { |
| 373 | match = ql.Eval(expr.Expr, valuer, f.hasFunctions) |
| 374 | } |
| 375 | |
| 376 | if match && by != nil { |
| 377 | e.AddSequenceLink(makeSequenceLinkID(valuer, by)) |
| 378 | } |
| 379 | |
| 380 | return match |
| 381 | } |
| 382 | |
| 383 | func (f *filter) RunSequence(e *event.Event, seqID int, partials map[int][]*event.Event, rawMatch bool) bool { |
| 384 | if f.seq == nil { |
no test coverage detected