English
group
Outbound groups: a human's choice, kept between runs, or a choice by probes; of one member or of several, among which connections are shared.
| Crate | ours-mod-group, modules/routing/group |
| Binary feature | group; group-probe → ours-mod-group/probe |
| Crate features | probe (ours-http, http) |
requires
tls— the probes' HTTP client takes TLS from theours_tls_options::Tlsfactory (Tls::of(cx.services)).cache— the choice in a group is saved in the cache file (ours_api::cache::of); the crate does not depend onours-mod-cache.
provides
Provide::Outbound { key: "group" }— a group is an outbound. It is written in thegroupssection, and the loader turns it into an outbound of kindgroup;set_persistent_tag(true)— a group of the native configuration always has a name, and the choice is stored by it.Provide::Schema { name: "groups" }—membersname outbounds or are matched against them.
Syntax: groups.
Dependencies
ours-http (probes), ours-tls-options, ours-atomic64, ours-bufpool, ours-api, ours-codec, ours-json, http.
Design
src/options.rs—GroupOptions;Rank:Manual(a human's choice),Order(the first to answer, in order),Delay(the fastest by the last probe),Stable(fast and steady oversamples, allowingmax_failures);Pick(Count(n)/All),Spread,Probe(url,interval,idle_timeout,tolerance,recovery).src/lib.rs—Group(an outbound): members are resolved through the currentDialTable;Inner::targetchooses a member;Pinned— a member pinned to a connection regardless of later changes;Unavailable— a group without members (subscriptions are empty) refuses new connections until a reload.inherit_selectioncarries the choice over on reload.src/probe.rs—Prober: one scheduler and I/O runtime per process; it survives the groups' reload, so that warmed-up mux sessions keep being served. Probes are bounded by a semaphore, a 15 s timeout;probe_oncejoins a check already in progress.src/probe_disabled.rs— a build withoutprobe: manual groups only.src/spread.rs—Spreader:Hash(a site = the last two labels of the domain, or the address), round-robin, random (SplitMix64 without locks),Sticky(a client on a site keeps a member for a given time); it remembers up to 1000 bindings.src/interrupt.rs—Epoch/Signal: interrupting existing connections when the choice changes (interrupt_exist_connections). Without it a group's streams are transparent and stay usable for splice.
Specifics
A group starts only after commit; a manual choice is kept across a failed reload and a restart.
Tests
modules/routing/group/tests/groups.rs (real forwarding, interruption, URL probes, the saved choice), tests/lifecycle.rs (starting after commit, the choice across failed reloads/restarts).