Replace GetAll by GetAllAsJSON and change storage package implementation

This commit is contained in:
TwinProduction
2021-01-08 22:41:57 -05:00
parent 19bb831fbf
commit 329bd86e09
3 changed files with 108 additions and 409 deletions

View File

@ -1,7 +1,6 @@
package watchdog
import (
"encoding/json"
"fmt"
"log"
"sync"
@ -21,10 +20,9 @@ var (
monitoringMutex sync.Mutex
)
// GetServiceStatusesAsJSON returns a list of core.ServiceStatus for each services encoded using json.Marshal.
// GetServiceStatusesAsJSON the JSON encoding of all core.ServiceStatus recorded
func GetServiceStatusesAsJSON() ([]byte, error) {
serviceStatuses := store.GetAll()
return json.Marshal(serviceStatuses)
return store.GetAllAsJSON()
}
// GetUptimeByServiceGroupAndName returns the uptime of a service based on its group and name