feat: runtime bootstrap snapshot cache with backoff
This commit is contained in:
1 parent
08f60a14d1
commit
aa6bb23e24
19 files changed
+1400
-384
No files matched your search
+37
-6
@@ -66,12 +66,43 @@ type Metrics struct {
|
||||
|
||||
// Meta is GET /api/meta.
|
||||
type Meta struct {
|
||||
DataVersion string `json:"data_version"`
|
||||
ModelVersion string `json:"model_version"`
|
||||
ContextVersion string `json:"context_version"`
|
||||
Coverage Coverage `json:"coverage"`
|
||||
Metrics Metrics `json:"metrics"`
|
||||
Limits []string `json:"limits"`
|
||||
DataVersion string `json:"data_version"`
|
||||
ModelVersion string `json:"model_version"`
|
||||
ContextVersion string `json:"context_version"`
|
||||
Coverage Coverage `json:"coverage"`
|
||||
Metrics Metrics `json:"metrics"`
|
||||
Limits []string `json:"limits"`
|
||||
Cache CacheStatus `json:"cache"`
|
||||
}
|
||||
|
||||
// CacheStatus is the runtime snapshot state exposed by GET /api/meta.
|
||||
// LastError, LastSuccessAt and NextRetryAt are null when they do not apply.
|
||||
type CacheStatus struct {
|
||||
Source string `json:"source"`
|
||||
LastSuccessAt *time.Time `json:"last_success_at"`
|
||||
LastError *string `json:"last_error"`
|
||||
NextRetryAt *time.Time `json:"next_retry_at"`
|
||||
Failures int `json:"failures"`
|
||||
}
|
||||
|
||||
// BootstrapMeta is the nested meta block of FastAPI GET /bootstrap.
|
||||
type BootstrapMeta struct {
|
||||
Coverage Coverage `json:"coverage"`
|
||||
Metrics Metrics `json:"metrics"`
|
||||
Limits []string `json:"limits"`
|
||||
}
|
||||
|
||||
// Bootstrap is the snapshot FastAPI serves at GET /bootstrap and Go keeps in
|
||||
// memory. Forecasts are deliberately absent: they come from /predict and are
|
||||
// cached separately as they are requested.
|
||||
type Bootstrap struct {
|
||||
DataVersion string `json:"data_version"`
|
||||
ModelVersion string `json:"model_version"`
|
||||
ContextVersion string `json:"context_version"`
|
||||
Sensors []Sensor `json:"sensors"`
|
||||
Series map[string][]Point `json:"series"`
|
||||
Context ContextData `json:"context"`
|
||||
Meta BootstrapMeta `json:"meta"`
|
||||
}
|
||||
|
||||
// WeatherNow is the current conditions block.
|
||||
|
||||
Reference in new issue
Block a user