2022-06-24 00:41:58 +00:00
|
|
|
package statestore
|
|
|
|
|
2022-06-27 15:47:07 +00:00
|
|
|
import "time"
|
|
|
|
|
2022-06-24 00:41:58 +00:00
|
|
|
type Repository interface {
|
|
|
|
GetModifyIndex(hostname string) (int, error)
|
|
|
|
SetModifyIndex(hostname string, index int) error
|
2022-06-27 15:47:07 +00:00
|
|
|
DeleteHost(hostname string) error
|
|
|
|
DeleteHosts(hostnames []string) error
|
|
|
|
GetOutdatedHosts(time time.Duration) ([]string, error)
|
2022-06-24 00:41:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Service interface {
|
|
|
|
CheckIfModified(hostname string, index int) (bool, error)
|
|
|
|
SaveState(hostname string, index int) error
|
2022-06-27 15:47:07 +00:00
|
|
|
PurgeStalledHosts(timeTreshold int) error
|
|
|
|
GetStalledHosts(timeTreshold int) ([]string, error)
|
2022-06-24 00:41:58 +00:00
|
|
|
}
|