Skip to main content

fetch_value

Function fetch_value 

Source
pub async fn fetch_value(
    session: &Session,
    key: &str,
    spec: FetchSpec,
) -> Result<FetchOutcome>
Expand description

Fetch one concrete key’s current value on demand — the value half of the lazy-observation contract (issue #84): a selection retrieves one value; nothing is prefetched, nothing stays subscribed.

The ladder, each rung bounded:

  1. GET the concrete key (storages answer; RFC 04 §3.2’s “a plain GET does not reach publisher caches” is exactly why rung 2 exists);
  2. GET <key>/@adv/**?_max=1 — zenoh-ext’s AdvancedPublisher cache declares its queryable there and replies with the cached sample on its own concrete key (@adv is verbatim, so no data selector ever collides with it — RFC 03 §4 D2 working in our favor);
  3. a brief callback subscription on the key, first sample wins.

Several answers on a rung (multiple storages) resolve by latest HLC timestamp; unstamped answers lose to stamped ones (RFC 04 §1.2’s LWW).