yera.ui.updates.service

Coordination for cached server-UI update checks.

Symbols

def refresh_update_state — Return current update state, refreshing it when necessary.
class UpdateService — Manage background release checks and their current cached result.

refresh_update_state

refresh_update_state(
    settings: Settings,
    client: httpx.AsyncClient,
    path: Path | None = None,
    now: datetime | None = None,
) → UpdateCheckState | None

Return current update state, refreshing it when necessary.

Parameters

settings
type: Settings

Global Yera settings controlling automatic update checks.

client
type: httpx.AsyncClient

HTTP client used for a due metadata request.

path
type: Path | None = None

Explicit persisted-state path, or None for the default.

now
type: datetime | None = None

Current time, injectable for deterministic tests.

Returns

type: UpdateCheckState | None

Current update-check state, or None when checks are disabled.

UpdateService

Manage background release checks and their current cached result.

Methods

__init__ — Configure the server-UI update service.
refresh — Refresh cached update state when its check interval has elapsed.
available_update — Return a cached release when it is newer than installed Yera.

UpdateService.__init__

__init__(
    settings: Settings,
    path: Path | None = None,
    installed_version: str | None = None,
    transport: httpx.AsyncBaseTransport | None = None,
    timeout_seconds: float = 2.0,
) → None

Configure the server-UI update service.

Parameters

settings
type: Settings

Global settings controlling automatic checks.

path
type: Path | None = None

Explicit persisted-state path, or None for the default.

installed_version
type: str | None = None

Installed Yera version, injectable for tests.

transport
type: httpx.AsyncBaseTransport | None = None

Optional HTTP transport for isolated testing.

timeout_seconds
type: float = 2.0

Maximum duration of the metadata request.

UpdateService.refresh

refresh() → None

Refresh cached update state when its check interval has elapsed.

UpdateService.available_update

available_update() → ReleaseMetadata | None

Return a cached release when it is newer than installed Yera.

Returns

type: ReleaseMetadata | None

Validated metadata for a newer release, otherwise None.