38 lines
515 B
Go
38 lines
515 B
Go
package collector
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"git.loafle.net/overflow/overflow_probes/commons"
|
|
)
|
|
|
|
type CollectorHandler interface {
|
|
commons.Handler
|
|
Start() error
|
|
Stop() error
|
|
Add() error
|
|
Remove() error
|
|
Update() error
|
|
}
|
|
|
|
func (c *collector) Serve() error {
|
|
|
|
var err error
|
|
ListenLoop:
|
|
for {
|
|
select {
|
|
case <-c.ShutdownChan:
|
|
err = errors.New("Shutting down")
|
|
break ListenLoop
|
|
}
|
|
}
|
|
|
|
return err
|
|
}
|
|
|
|
func (c *collector) Shutdown(ctx context.Context) error {
|
|
c.ShutdownChan <- true
|
|
return nil
|
|
}
|