Skip to main content

history_sources

Function history_sources 

Source
pub fn history_sources(
    head_record: &[u8],
    history: &[Vec<u8>],
) -> Result<HistorySources, HistoryError>
Expand description

Name the live metadata blob and the original an asset’s adoption needs, from its head record (a feed entry’s manifest_cbor) and the records before it (fetch_history’s answer).

This is how a device that first sees an asset at its delete on an album page, which names no byte reference on a tombstone, finds what to fetch: the delete binds no metadata blob, so the live one is the newest record of the history that binds one, and the delete still commits to the asset’s original. Both are served by the blob route to the asset’s readers until its retention window closes. A head that binds a metadata blob names its own, so an entry that names one agrees with this.

Nothing is trusted for being read here: the adoption binds the metadata blob to the record that names it and the original to the head’s content address, so a wrong answer is refused there, never adopted.

§Errors

HistoryError::Malformed when the head or a history record does not decode (hash is head or the record’s position), and HistoryError::Unbound when no record binds a metadata blob.