Skip to main content

fetch_history

Function fetch_history 

Source
pub async fn fetch_history<B, S, C>(
    fetcher: &RangedFetcher<S, C>,
    source: &B,
    head_record: &[u8],
) -> Result<Vec<Vec<u8>>, HistoryError>
Expand description

Walk an asset’s provenance chain back from head_record (the manifest_cbor a feed entry carries) to its create, fetching each record the one after it names by prior_provenance_hash through source (GET /v1/blob/{hash}, where the server keeps an asset’s superseded records under the live record’s read authority).

Returns the records before the head, oldest first, each the exact bytes the server holds, verified against its content address by the fetch: what Workspace::adopt_remote_history takes. A head that is its asset’s create has no history, and the walk fetches nothing.

Nothing is trusted for being fetched: the walk only follows links, and the chain is verified record by record when it is adopted.

§Errors

HistoryError; the walk stops at the first record it cannot fetch or decode.