More work on modeling
This commit is contained in:
parent
820fd5b747
commit
f58cccf6d2
|
|
@ -1,16 +0,0 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Raptor struct {
|
||||
ID int
|
||||
Name string
|
||||
Description string
|
||||
Interval time.Duration
|
||||
Timeout time.Duration
|
||||
Retries int
|
||||
|
||||
Instructions string
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
package common
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type RaptorSpawner interface {
|
||||
}
|
||||
|
||||
type Result struct {
|
||||
Success bool
|
||||
ExecutionTime time.Time
|
||||
Latency time.Duration
|
||||
ErrorMessage string
|
||||
}
|
||||
|
||||
type UptimeRaptor interface {
|
||||
GetRaptors() []Raptor
|
||||
}
|
||||
|
||||
type RaptorSpecies interface {
|
||||
Slug() string
|
||||
Name() string
|
||||
Description() string
|
||||
Start(*UptimeRaptor) (chan Result, error)
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* This file is part of the Uptime Raptor (https://uptime-raptor.net).
|
||||
* Copyright (c) 2023 Radu Andries.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package common
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Single configuration
|
||||
type Raptor struct {
|
||||
Name string
|
||||
Description string
|
||||
Interval time.Duration
|
||||
Timeout time.Duration
|
||||
Retries int
|
||||
// YAML String with specific configuration
|
||||
Instructions string
|
||||
}
|
||||
|
||||
// reads configuration for raptors
|
||||
type RaptorFlock interface {
|
||||
ListRaptors() ([]Raptor, error)
|
||||
GetConfiguration(namespace string, key string) (string, error)
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* This file is part of the Uptime Raptor (https://uptime-raptor.net).
|
||||
* Copyright (c) 2023 Radu Andries.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package common
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
Agg1m int = 1
|
||||
Agg5m
|
||||
Agg1h
|
||||
Agg1d
|
||||
)
|
||||
|
||||
// Discovers RaptorSpecies - plugin manager?
|
||||
type Archeologist interface {
|
||||
Discover(*UptimeRaptor, string) (*RaptorSpecies, error)
|
||||
}
|
||||
|
||||
// result from a Raptor run
|
||||
type Result struct {
|
||||
Success bool
|
||||
ExecutionTime time.Time
|
||||
Latency time.Duration
|
||||
ErrorMessage string
|
||||
}
|
||||
|
||||
// main application interface. entry point for all
|
||||
type UptimeRaptor interface {
|
||||
GetFlock() *RaptorFlock
|
||||
GetExecutionHistory(name string, aggregation time.Duration, delta time.Duration)
|
||||
SubscribeToRaptorResults(name string) (chan Result, error)
|
||||
}
|
||||
|
||||
// Instance provided of type of monitoring
|
||||
// examples: http, cert, json, minecraft, expression
|
||||
type RaptorSpecies interface {
|
||||
Slug() string
|
||||
Name() string
|
||||
Description() string
|
||||
Start(*UptimeRaptor, *Raptor) (chan Result, error)
|
||||
}
|
||||
Loading…
Reference in New Issue