Documentation
¶
Overview ¶
Package client provides HTTP clients for communicating with Kedastral services.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ForecasterClient ¶
type ForecasterClient struct {
// contains filtered or unexported fields
}
ForecasterClient is an HTTP client for fetching forecast snapshots from the forecaster service. It is safe for concurrent use by multiple goroutines.
func NewForecasterClient ¶
func NewForecasterClient(baseURL string) *ForecasterClient
NewForecasterClient creates a new client for the forecaster service. The baseURL should include the scheme and host (e.g., "http://localhost:8081"). A default timeout of 5 seconds is used for HTTP requests.
func NewForecasterClientWithTimeout ¶
func NewForecasterClientWithTimeout(baseURL string, timeout time.Duration) *ForecasterClient
NewForecasterClientWithTimeout creates a new client with a custom timeout.
func (*ForecasterClient) GetSnapshot ¶
func (c *ForecasterClient) GetSnapshot(ctx context.Context, workload string) (*SnapshotResult, error)
GetSnapshot fetches the latest forecast snapshot for a workload. Returns the snapshot and whether it's marked as stale by the forecaster.
The context can be used to cancel the request or set deadlines. If the workload is not found, returns an error.
type SnapshotResponse ¶
type SnapshotResponse struct {
Workload string `json:"workload"`
Metric string `json:"metric"`
GeneratedAt time.Time `json:"generatedAt"`
StepSeconds int `json:"stepSeconds"`
HorizonSeconds int `json:"horizonSeconds"`
Values []float64 `json:"values"`
DesiredReplicas []int `json:"desiredReplicas"`
}
SnapshotResponse represents the JSON response from GET /forecast/current. This matches the structure defined in SPEC.md §3.1.
type SnapshotResult ¶
type SnapshotResult struct {
Snapshot storage.Snapshot
Stale bool // true if X-Kedastral-Stale header was present
}
SnapshotResult contains the snapshot and metadata about staleness.