Skip to main content

put_direct

Function put_direct 

Source
pub async fn put_direct(
    resolve_via: &mut Session,
    id: &KeyPair,
    station: [u8; 32],
    data: &[u8],
    name: impl Into<String>,
    timeout: Duration,
) -> Result<Mcid, PutDirectError>
Expand description

Stores data at a KNOWN station directly, in one hop, instead of going through whatever station resolve_via happens to be connected to. Mirrors macula_feeder:start_link_direct/5,6, which — unlike procedure/stream direct-dial — takes the target station’s pubkey directly rather than resolving one via a procedure_advertisement: content has no “procedure” to advertise, so there is nothing to resolve here beyond the station’s own station_endpoint (resolve_station_endpoint). resolve_via is used only to query the DHT for station’s station_endpoint; it does not need to already be connected to station.

Caveat found live in macula-go’s port of this same function: if resolve_via happens to already be connected to station (the common case when the caller doesn’t have a separate resolver session), this call’s own internal dial reuses id against the SAME station resolve_via is on — this fleet enforces one connection per identity and kicks whichever connects second, so resolve_via’s own connection can be closed out from under the caller by this call. Use a different identity for resolve_via than for id if the caller needs resolve_via to keep working afterward against that same station.