Skip to main content

Module blossom_capabilities

Module blossom_capabilities 

Source
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§

CapabilityEntry
CapabilityState
Per-server snapshot used for tier classification.
UploadVerdict
Whether an upload is worth attempting, and if not, why each server would refuse it — in the words of its own document where it has one.

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
upload_verdict as a yes/no.
classify
Pure tier-classification (DB-free, unit-testable). Reorders into informed-yes → known-good → unknown → too-large → MIME-rejected → informed-no, stable within tier.
has_fresh_capability_for
True iff a row exists for (server, mime, encrypted) and is younger than STALE_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.
preflight_redundant
Whether a BUD-06 preflight to server_url could only say yes: a fresh upload of this kind at this size or larger went through, nothing this size has been refused since, and the server’s own document for this account doesn’t say no.
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 servers for an upload of (mime, encrypted, size_bytes).
record_accepted
Record a successful upload. Bumps max_accepted_size; clears min_rejected_size if reality contradicts it (the old rejection was a flake, not a policy). session pins 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_size this gives pre-flight “too large” feedback. Outcome is SIZE_ONLY (not REJECTED_MIME) — smaller blobs of the same MIME may still succeed.
upload_verdict
Pre-flight check across the enabled servers. A server’s document is believed outright; a server we have only learned from bounces counts against only when it has rejected this size or type before. Unknown servers count as “likely accepts” so the check stays optimistic.