Skip to main content

Module fetcher

Module fetcher 

Source
Expand description

Coalesced, failover federation fetch of raw event bytes.

Service::fetch is the entry point; behind it a single worker task owns every in-flight fetch and the dedup map, so no lock guards them. The per-fetch work splits across the submodules: candidate selection, the federation transport, and response validation.

Re-exportsยง

use std::sync::Arc; ๐Ÿ”’
use async_trait::async_trait; ๐Ÿ”’
use loole::Receiver; ๐Ÿ”’
use loole::Sender; ๐Ÿ”’
use loole::unbounded; ๐Ÿ”’
use tokio::sync::oneshot; ๐Ÿ”’
use tokio::sync::oneshot::channel; ๐Ÿ”’
use tokio::sync::watch; ๐Ÿ”’
use tuwunel_core::Result; ๐Ÿ”’
use tuwunel_core::implement; ๐Ÿ”’
pub use self::opts::EventWindow;
pub use self::opts::FanoutGrowth;
pub use self::opts::Op;
pub use self::opts::Opts;
pub use self::opts::Outcome;
use self::error::Failure; ๐Ÿ”’
use self::inflight::Key; ๐Ÿ”’
use self::inflight::SharedResult; ๐Ÿ”’
use self::inflight::Subscription; ๐Ÿ”’
use self::select::RoomCandidates; ๐Ÿ”’
use self::select::Select; ๐Ÿ”’
use self::transport::FederationTransport; ๐Ÿ”’
use self::transport::Transport; ๐Ÿ”’
use crate::services::OnceServices; ๐Ÿ”’

Modulesยง

error ๐Ÿ”’
Internal failure reporting for federation fetches.
inflight ๐Ÿ”’
Single-flight bookkeeping for one in-flight fetch.
opts ๐Ÿ”’
Caller contract and result types for a fetch: Opts in, Outcome out.
select ๐Ÿ”’
Candidate server selection for a fetch.
transport ๐Ÿ”’
Federation transport: an Op and target server in, raw response bytes out.
validate ๐Ÿ”’
Two-tier response validation for fetched federation data.
worker ๐Ÿ”’
The fetch worker loop: one task owning every in-flight fetch, lock-free.

Structsยง

Msg ๐Ÿ”’
Request to the worker. The worker replies with a subscription to the coalesced result, deferring the reply under backpressure until a slot frees.
Service
Coordinates coalesced, validated federation fetches with candidate failover.

Constantsยง

REQUESTS_MAX ๐Ÿ”’
Upper bound on concurrent in-flight fetches across all keys.

Functionsยง

await_result ๐Ÿ”’