FeedFetch

sealed interface FeedFetch(source)

The outcome of a successful fetch: Fetched or NotModified. Stable Core. The two are the whole contract, so a when over a FeedFetch needs no else. Whichever you got, store validators first, then adopt or ignore permanentlyMovedTo, then use the feed on Fetched.

What the caller owns: storing the validators after every response (a 200 replaces both, a 304 replaces each one it carries); dropping its validators when finalUrl differs from the one it stored with them (a validator from one server must not reach another: a coincidental match returns a false 304); deciding whether to adopt permanentlyMovedTo (a fact about the redirect chain, not an instruction: adopt it only when the chain's first request was https, or after the same value was reported on several polls, because one injected 301 over cleartext would re-point the subscription); polling and back-off; the meaning of 410; what to show on the first poll; and which entries are new (entries.filter { it.id !in seen }; never by date).

Inheritors

Types

Link copied to clipboard
class Fetched(val feed: Feed, val validators: FeedValidators, val finalUrl: Url, val permanentlyMovedTo: Url?) : FeedFetch

A new representation (200 or 203), parsed.

Link copied to clipboard
class NotModified(val validators: FeedValidators, val finalUrl: Url, val permanentlyMovedTo: Url?) : FeedFetch

The stored representation is current (304 to a conditional request). validators are the sent ones refreshed by what the 304 carried.

Properties

Link copied to clipboard
abstract val finalUrl: Url

The URL the response came from: the last URL requested.

Link copied to clipboard
abstract val permanentlyMovedTo: Url?

The target of the last hop of the leading run of 301/308 redirects, or null when there is none or it equals the requested URL.

Link copied to clipboard

The validators to store: what the next FeedFetcher.fetch should send.