Expand description
Per-(server, mime, encrypted) Blossom capability cache and routing.
Uploads report outcomes here; rank_servers() reorders the enabled
list so known-good servers are tried first.
Structs§
- Capability
Entry - Capability
State - Per-server snapshot used for tier classification.
Constants§
- OUTCOME_
ACCEPTED - OUTCOME_
REJECTED_ MIME - OUTCOME_
SIZE_ ONLY - Seeded by a 413-only rejection (no successful upload yet). Kept distinct from ACCEPTED so the UI doesn’t claim an empty accepted state.
- STALE_
AFTER_ SECS - Rows older than this are routed as “unknown” and re-probed. Server policies drift (limit bumps, MIME allow-list edits) so we refresh.
Functions§
- any_
server_ likely_ accepts - Pre-flight check: is there any enabled server we haven’t already learned will reject this size/MIME/context? Unknown servers count as “likely accepts” so we stay optimistic.
- classify
- Pure tier-classification (DB-free, unit-testable). Reorders into known-good → unknown → too-large → MIME-rejected, stable within tier.
- has_
fresh_ capability_ for - True iff a row exists for
(server, mime, encrypted)and is younger thanSTALE_AFTER_SECS. Used by the probe scheduler to skip rows we already have current data for. - is_
mime_ rejection - Classify an upload error as a permanent MIME rejection.
- is_
size_ rejection - HTTP 413 = “blob exceeds size cap”. Drives
min_rejected_size. - list_
for_ server - All rows for
server_url, most-recent first. Renders the info dialog. - purge_
server - Drop every cached row for
server_url. Called on hard-remove so a later re-add starts with a clean slate. - rank_
servers - Reorder
serversfor an upload of(mime, encrypted, size_bytes). - record_
accepted - Record a successful upload. Bumps
max_accepted_size; clearsmin_rejected_sizeif reality contradicts it (the old rejection was a flake, not a policy).sessionpins the write to the account that started the upload so a mid-flight swap can’t bleed. - record_
rejected_ mime - Mark this
(server, mime, encrypted)triple as MIME-rejected. Future uploads route around the server. - record_
rejected_ size - Record an HTTP 413. Tracks the smallest rejected size; combined with
max_accepted_sizethis gives pre-flight “too large” feedback. Outcome isSIZE_ONLY(notREJECTED_MIME) — smaller blobs of the same MIME may still succeed.