NewEngine builds a fresh rules engine instance.
(psnap ps.Snapshotter, config *config.Config)
| 130 | |
| 131 | // NewEngine builds a fresh rules engine instance. |
| 132 | func NewEngine(psnap ps.Snapshotter, config *config.Config) *Engine { |
| 133 | e := &Engine{ |
| 134 | filters: newFilterset(), |
| 135 | matches: make([]*ruleMatch, 0), |
| 136 | sequences: make([]*sequenceState, 0), |
| 137 | psnap: psnap, |
| 138 | config: config, |
| 139 | scavenger: time.NewTicker(sequenceGcInterval), |
| 140 | compiler: newCompiler(psnap, config), |
| 141 | } |
| 142 | |
| 143 | go e.gcSequences() |
| 144 | |
| 145 | return e |
| 146 | } |
| 147 | |
| 148 | func (e *Engine) gcSequences() { |
| 149 | for { |