Add Status in runtime interface and use it for runtime health check.

This commit is contained in:
Random-Liu
2016-03-03 02:01:15 -08:00
parent 7215860ecd
commit 07b21c50fa
10 changed files with 191 additions and 280 deletions

View File

@@ -30,7 +30,6 @@ type runtimeState struct {
internalError error
cidr string
initError error
runtimeCompatibility func() error
}
func (s *runtimeState) setRuntimeSync(t time.Time) {
@@ -85,16 +84,12 @@ func (s *runtimeState) errors() []string {
if s.internalError != nil {
ret = append(ret, s.internalError.Error())
}
if err := s.runtimeCompatibility(); err != nil {
ret = append(ret, err.Error())
}
return ret
}
func newRuntimeState(
runtimeSyncThreshold time.Duration,
configureNetwork bool,
runtimeCompatibility func() error,
) *runtimeState {
var networkError error = nil
if configureNetwork {
@@ -105,6 +100,5 @@ func newRuntimeState(
baseRuntimeSyncThreshold: runtimeSyncThreshold,
networkError: networkError,
internalError: nil,
runtimeCompatibility: runtimeCompatibility,
}
}