generalized store state
This commit is contained in:
parent
57aed13e0f
commit
93f0047945
@ -9,12 +9,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type StoreStatus struct {
|
||||
LastRefresh time.Time
|
||||
LastError error
|
||||
State int
|
||||
}
|
||||
|
||||
type RoutesStore struct {
|
||||
routesMap map[sources.Source]api.RoutesResponse
|
||||
statusMap map[sources.Source]StoreStatus
|
||||
|
@ -1,8 +1,33 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
STATE_INIT = iota
|
||||
STATE_READY
|
||||
STATE_UPDATING
|
||||
STATE_ERROR
|
||||
)
|
||||
|
||||
type StoreStatus struct {
|
||||
LastRefresh time.Time
|
||||
LastError error
|
||||
State int
|
||||
}
|
||||
|
||||
// Helper: stateToString
|
||||
func stateToString(state int) string {
|
||||
switch state {
|
||||
case STATE_INIT:
|
||||
return "INIT"
|
||||
case STATE_READY:
|
||||
return "READY"
|
||||
case STATE_UPDATING:
|
||||
return "UPDATING"
|
||||
case STATE_ERROR:
|
||||
return "ERROR"
|
||||
}
|
||||
return "INVALID"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user