75f3dd141c
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CI and Release / lint-frontend (push) Has been cancelled
CI and Release / dockerfile-scan (push) Has been cancelled
CI and Release / test-frontend (push) Has been cancelled
CI and Release / lint-verification-agent (push) Has been cancelled
CI and Release / test-verification-agent (push) Has been cancelled
CI and Release / e2e-verification-agent (push) Has been cancelled
CI and Release / test-backend (push) Has been cancelled
CI and Release / build-dev-image (push) Has been cancelled
CI and Release / push-dev-image (push) Has been cancelled
CI and Release / build-image (push) Has been cancelled
CI and Release / build-verification-image (push) Has been cancelled
CI and Release / determine-version (push) Has been cancelled
CI and Release / push-image (push) Has been cancelled
CI and Release / push-verification-image (12) (push) Has been cancelled
CI and Release / lint-backend (push) Has been cancelled
CI and Release / push-verification-image (17) (push) Has been cancelled
CI and Release / push-verification-image (18) (push) Has been cancelled
CI and Release / release (push) Has been cancelled
CI and Release / publish-helm-chart (push) Has been cancelled
CI and Release / push-verification-image (13) (push) Has been cancelled
CI and Release / push-verification-image (14) (push) Has been cancelled
CI and Release / push-verification-image (15) (push) Has been cancelled
CI and Release / push-verification-image (16) (push) Has been cancelled
38 lines
1.2 KiB
Go
38 lines
1.2 KiB
Go
package api
|
|
|
|
import "time"
|
|
|
|
const (
|
|
versionPath = "/api/v1/system/version"
|
|
verificationAgentBinaryPath = "/api/v1/system/verification-agent"
|
|
heartbeatPathFmt = "/api/v1/agent/verification/%s/heartbeat"
|
|
|
|
claimPathFmt = "/api/v1/agent/verifications/%s/claim"
|
|
backupStreamPathFmt = "/api/v1/agent/verifications/%s/%s/backup-stream"
|
|
reportPathFmt = "/api/v1/agent/verifications/%s/%s/report"
|
|
|
|
apiCallTimeout = 30 * time.Second
|
|
maxRetryAttempts = 3
|
|
retryBaseDelay = 1 * time.Second
|
|
|
|
maxBackoff = 32 * time.Second
|
|
|
|
agentVersionHeader = "X-Databasus-Version"
|
|
)
|
|
|
|
// Forces revalidation at any intermediary already holding a stale entry —
|
|
// response-side no-store only stops a proxy from caching from now on.
|
|
var noCacheHeaders = map[string]string{
|
|
"Cache-Control": "no-cache",
|
|
"Pragma": "no-cache",
|
|
}
|
|
|
|
// timeAfterFn is time.After in production; tests swap it to avoid real sleeps in
|
|
// the report retry loop. reportRetryBudget is the report retry deadline (60s in
|
|
// production); tests shrink it to exercise budget exhaustion without a 60s
|
|
// wall-clock wait.
|
|
var (
|
|
timeAfterFn = time.After
|
|
reportRetryBudget = 60 * time.Second
|
|
)
|