Skip to main content

get_direct

Function get_direct 

Source
pub async fn get_direct(
    resolve_via: &mut Session,
    id: &KeyPair,
    mcid: Mcid,
    timeout: Duration,
) -> Result<Vec<u8>, GetDirectError>
Expand description

Fetches and verifies the content addressed by mcid from whichever station a signed content_announcement names as its host, dialing that station in one hop instead of relaying through resolve_via’s own station. Mirrors macula_direct_dial:get_content/3.

Architectural note this module’s other direct-dial functions don’t need: a content_announcement’s endpoint is the FINAL dial target directly (see macula_record:read_content_announcement/1’s endpoint field and macula:get_content_station/5’s use of it as-is) — unlike procedure_advertisement, there is no station-relay indirection, so the announcer must genuinely BE independently dialable there. A plain outbound-only leaf (everything this SDK’s own identity/session model supports) cannot legitimately publish one of these about itself — only something with its own listening identity (macula-station, or a dedicated content-serving relay) can; confirmed directly against macula.erl, which states a content_announcement is made “automatically by the station on receipt,” not by an arbitrary publisher. This crate therefore does not expose a client-facing “announce content direct”: dht::new_content_announcement stays a low-level primitive (mirroring macula_record.erl’s own export) for that kind of infrastructure-tier code, not ordinary leaf use. get_direct itself has no such limitation — resolving and fetching FROM an already-announced provider is a perfectly ordinary leaf operation.