Move providers into their own package

This commit is contained in:
Fabian Reinartz 2015-09-25 13:12:51 +02:00
parent 575b2257b1
commit 0ffdd6fa2f
2 changed files with 18 additions and 10 deletions

View File

@ -8,6 +8,8 @@ import (
"github.com/prometheus/common/model"
"github.com/prometheus/log"
"golang.org/x/net/context"
"github.com/prometheus/alertmanager/provider"
)
const ResolveTimeout = 30 * time.Second
@ -16,7 +18,7 @@ const ResolveTimeout = 30 * time.Second
// assigns the correct notifiers to each.
type Dispatcher struct {
routes Routes
alertProvider AlertProvider
alertProvider provider.Alerts
aggrGroups map[model.Fingerprint]*aggrGroup
notifiers map[string]Notifier

View File

@ -15,10 +15,12 @@ package manager
import (
"github.com/prometheus/common/model"
"github.com/prometheus/alertmanager/config"
)
// AlertProvider gives access to a set of alerts.
type AlertProvider interface {
// Alerts gives access to a set of alerts.
type Alerts interface {
// Iter returns a channel on which all active alerts from the
// beginning of time are sent. They are not guaranteed to be in
// chronological order.
@ -31,8 +33,8 @@ type AlertProvider interface {
Del(model.Fingerprint) error
}
// SilenceProvider gives access to silences.
type SilenceProvider interface {
// Silences gives access to silences.
type Silences interface {
Silencer
// All returns all existing silences.
@ -45,9 +47,13 @@ type SilenceProvider interface {
Get(model.Fingerprint) (*Silence, error)
}
type ConfigProvider interface {
// Reload initiates a configuration reload.
Reload() error
// Get returns the current configuration.
Get() *Config
// Reloadable is a component that can change its state based
// on a new configuration.
type Reloadable interface {
ApplyConfig(*config.Config)
}
type Config interface {
// Reload initiates a configuration reload.
Reload(...Reloadable) error
}