huge refactor

- extendable backends
- better project structure
- better cli interface
This commit is contained in:
Matej Kramny
2019-02-20 11:14:45 +08:00
parent df31238a1f
commit 162d55b3f3
17 changed files with 946 additions and 705 deletions

19
backends/interface.go Normal file
View File

@@ -0,0 +1,19 @@
package backends
import (
"net/http"
"github.com/castawaylabs/cachet-monitor/monitors"
)
type BackendInterface interface {
Ping() error
Tick(monitor monitors.MonitorInterface, status monitors.MonitorStatus, errs []error, lag int64)
SendMetric(monitor monitors.MonitorInterface, lag int64) error
UpdateMonitor(monitor monitors.MonitorInterface, status, previousStatus monitors.MonitorStatus, errs []error) error
NewRequest(requestType, url string, reqBody []byte) (*http.Response, interface{}, error)
Describe() []string
Validate() []string
ValidateMonitor(monitor *monitors.AbstractMonitor) []string
}