http connector first impl

This commit is contained in:
Ilia Denisov
2026-03-12 23:45:06 +02:00
committed by GitHub
parent f985370089
commit 9adadc3bbf
13 changed files with 962 additions and 41 deletions
+4 -4
View File
@@ -2,7 +2,7 @@ package connector
import (
"context"
model "galaxy/model/client"
"galaxy/model/client"
"galaxy/model/report"
)
@@ -11,7 +11,7 @@ type Connector interface {
UIConnector
// CheckConnection is called asynchronously every 5 seconds and tests is connection available with a specific backend server endpoint.
// There is guaranteed backoff 5s -> 15s -> 30s -> 60s when no connection is available.
// There is guaranteed jittered backoff with caps 5s -> 15s -> 30s -> 60s when no connection is available.
CheckConnection() bool
// CheckVersion is called asynchronously every 30 minutes and receives from backend server information about currently available app versions.
@@ -26,11 +26,11 @@ type UIConnector interface {
// FetchReport asynchronously requests from backend server a [report.Report] for a given [model.GameID] and turn number.
// Passed callback func will will accept non-nil error in case of I/O or decoding errors occuried,
// otherwise callback func accepts loaded [report.Report].
FetchReport(context.Context, model.GameID, uint, func(report.Report, error))
FetchReport(context.Context, client.GameID, uint, func(report.Report, error))
}
type VersionInfo struct {
OS string `json:"os"` // Operating System name (unix, darwin, windows, etc.)
Version string `json:"version"` // Semver format: X.Y.Z
URL string `json:"url"` // URL for download artifacto for this version
URL string `json:"url"` // Artifact download URL for this version
}