NewLoader loads rules from disk, and watches for changes made to the rules files on disk.
(liveReload bool)
| 38 | // NewLoader loads rules from disk, and watches for changes made to the rules files |
| 39 | // on disk. |
| 40 | func NewLoader(liveReload bool) (*Loader, error) { |
| 41 | watcher, err := fsnotify.NewWatcher() |
| 42 | if err != nil { |
| 43 | return nil, err |
| 44 | } |
| 45 | return &Loader{ |
| 46 | Path: "", |
| 47 | rules: make(map[string]*Rule), |
| 48 | liveReload: liveReload, |
| 49 | watcher: watcher, |
| 50 | liveReloadRunning: false, |
| 51 | stopLiveReload: make(chan struct{}), |
| 52 | }, nil |
| 53 | } |
| 54 | |
| 55 | // NumRules returns he number of loaded rules. |
| 56 | func (l *Loader) NumRules() int { |
no outgoing calls