platform: modularize api/gui, add docs-tests-web foundation, and refresh root config

This commit is contained in:
beckline
2026-03-26 22:40:54 +03:00
parent 0e2d7f61ea
commit 6a56d734c2
562 changed files with 70151 additions and 16423 deletions

View File

@@ -0,0 +1,64 @@
package app
import (
refreshcoordpkg "selective-vpn-api/app/refreshcoord"
"time"
)
type refreshStateSnapshot = refreshcoordpkg.Snapshot
type refreshCoordinator struct {
inner refreshcoordpkg.Coordinator
}
func newRefreshCoordinator(freshTTL, backoffMin, backoffMax time.Duration) refreshCoordinator {
return refreshCoordinator{inner: refreshcoordpkg.New(freshTTL, backoffMin, backoffMax)}
}
func (c *refreshCoordinator) setUpdatedAt(at time.Time) {
c.inner.SetUpdatedAt(at)
}
func (c *refreshCoordinator) beginRefresh(now time.Time, force bool, hasData bool) bool {
return c.inner.BeginRefresh(now, force, hasData)
}
func (c *refreshCoordinator) shouldRefresh(now time.Time, force bool, hasData bool) bool {
return c.inner.ShouldRefresh(now, force, hasData)
}
func (c *refreshCoordinator) isStale(now time.Time) bool {
return c.inner.IsStale(now)
}
func (c *refreshCoordinator) finishSuccess(now time.Time) {
c.inner.FinishSuccess(now)
}
func (c *refreshCoordinator) finishError(msg string, now time.Time) {
c.inner.FinishError(msg, now)
}
func (c *refreshCoordinator) snapshot(now time.Time) refreshStateSnapshot {
return c.inner.Snapshot(now)
}
func (c *refreshCoordinator) refreshInProgress() bool {
return c.inner.RefreshInProgress()
}
func (c *refreshCoordinator) nextRetryAt() time.Time {
return c.inner.NextRetryAt()
}
func (c *refreshCoordinator) clearBackoff() {
c.inner.ClearBackoff()
}
func (c *refreshCoordinator) consecutiveErrors() int {
return c.inner.ConsecutiveErrors()
}
func (c *refreshCoordinator) lastError() string {
return c.inner.LastError()
}