|
@@ -16,6 +16,7 @@ var (
|
|
|
type Prober interface {
|
|
type Prober interface {
|
|
|
AddHTTP(id string, probingInterval time.Duration, endpoints []string) error
|
|
AddHTTP(id string, probingInterval time.Duration, endpoints []string) error
|
|
|
Remove(id string) error
|
|
Remove(id string) error
|
|
|
|
|
+ RemoveAll()
|
|
|
Reset(id string) error
|
|
Reset(id string) error
|
|
|
Status(id string) (Status, error)
|
|
Status(id string) (Status, error)
|
|
|
}
|
|
}
|
|
@@ -88,6 +89,16 @@ func (p *prober) Remove(id string) error {
|
|
|
return nil
|
|
return nil
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func (p *prober) RemoveAll() {
|
|
|
|
|
+ p.mu.Lock()
|
|
|
|
|
+ defer p.mu.Unlock()
|
|
|
|
|
+
|
|
|
|
|
+ for _, s := range p.targets {
|
|
|
|
|
+ close(s.stopC)
|
|
|
|
|
+ }
|
|
|
|
|
+ p.targets = make(map[string]*status)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func (p *prober) Reset(id string) error {
|
|
func (p *prober) Reset(id string) error {
|
|
|
p.mu.Lock()
|
|
p.mu.Lock()
|
|
|
defer p.mu.Unlock()
|
|
defer p.mu.Unlock()
|