mirror of
https://github.com/n0-computer/iroh.git
synced 2026-11-30 08:01:44 +00:00
70 lines
16 KiB
HTML
70 lines
16 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Common interface for different congestion controllers"><title>Controller in iroh::endpoint - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="iroh" data-themes="" data-resource-suffix="" data-rustdoc-version="1.92.0-nightly (b6f0945e4 2025-10-08)" data-channel="nightly" data-search-js="search-8d3311b9.js" data-stringdex-js="stringdex-828709d0.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Controller</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../iroh/index.html">iroh</a><span class="version">0.95.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Controller</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.clone_box" title="clone_box">clone_box</a></li><li><a href="#tymethod.initial_window" title="initial_window">initial_window</a></li><li><a href="#tymethod.into_any" title="into_any">into_any</a></li><li><a href="#tymethod.on_congestion_event" title="on_congestion_event">on_congestion_event</a></li><li><a href="#tymethod.on_mtu_update" title="on_mtu_update">on_mtu_update</a></li><li><a href="#tymethod.window" title="window">window</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.metrics" title="metrics">metrics</a></li><li><a href="#method.on_ack" title="on_ack">on_ack</a></li><li><a href="#method.on_end_acks" title="on_end_acks">on_end_acks</a></li><li><a href="#method.on_sent" title="on_sent">on_sent</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In iroh::<wbr>endpoint</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">iroh</a>::<wbr><a href="index.html">endpoint</a></div><h1>Trait <span class="trait">Controller</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"></span></div><pre class="rust item-decl"><code>pub trait Controller: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> {
|
||
// Required methods
|
||
fn <a href="#tymethod.on_congestion_event" class="fn">on_congestion_event</a>(
|
||
&mut self,
|
||
now: <a class="struct" href="https://doc.rust-lang.org/nightly/std/time/struct.Instant.html" title="struct std::time::Instant">Instant</a>,
|
||
sent: <a class="struct" href="https://doc.rust-lang.org/nightly/std/time/struct.Instant.html" title="struct std::time::Instant">Instant</a>,
|
||
is_persistent_congestion: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,
|
||
lost_bytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>,
|
||
);
|
||
<span class="item-spacer"></span> fn <a href="#tymethod.on_mtu_update" class="fn">on_mtu_update</a>(&mut self, new_mtu: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>);
|
||
<span class="item-spacer"></span> fn <a href="#tymethod.window" class="fn">window</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>;
|
||
<span class="item-spacer"></span> fn <a href="#tymethod.clone_box" class="fn">clone_box</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="trait.Controller.html" title="trait iroh::endpoint::Controller">Controller</a>>;
|
||
<span class="item-spacer"></span> fn <a href="#tymethod.initial_window" class="fn">initial_window</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>;
|
||
<span class="item-spacer"></span> fn <a href="#tymethod.into_any" class="fn">into_any</a>(self: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><Self>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a>>;
|
||
|
||
// Provided methods
|
||
fn <a href="#method.on_sent" class="fn">on_sent</a>(&mut self, now: <a class="struct" href="https://doc.rust-lang.org/nightly/std/time/struct.Instant.html" title="struct std::time::Instant">Instant</a>, bytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>, last_packet_number: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>) { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.on_ack" class="fn">on_ack</a>(
|
||
&mut self,
|
||
now: <a class="struct" href="https://doc.rust-lang.org/nightly/std/time/struct.Instant.html" title="struct std::time::Instant">Instant</a>,
|
||
sent: <a class="struct" href="https://doc.rust-lang.org/nightly/std/time/struct.Instant.html" title="struct std::time::Instant">Instant</a>,
|
||
bytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>,
|
||
app_limited: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,
|
||
rtt: &RttEstimator,
|
||
) { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.on_end_acks" class="fn">on_end_acks</a>(
|
||
&mut self,
|
||
now: <a class="struct" href="https://doc.rust-lang.org/nightly/std/time/struct.Instant.html" title="struct std::time::Instant">Instant</a>,
|
||
in_flight: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>,
|
||
app_limited: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,
|
||
largest_packet_num_acked: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>>,
|
||
) { ... }
|
||
<span class="item-spacer"></span> fn <a href="#method.metrics" class="fn">metrics</a>(&self) -> ControllerMetrics { ... }
|
||
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Common interface for different congestion controllers</p>
|
||
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.on_congestion_event" class="method"><h4 class="code-header">fn <a href="#tymethod.on_congestion_event" class="fn">on_congestion_event</a>(
|
||
&mut self,
|
||
now: <a class="struct" href="https://doc.rust-lang.org/nightly/std/time/struct.Instant.html" title="struct std::time::Instant">Instant</a>,
|
||
sent: <a class="struct" href="https://doc.rust-lang.org/nightly/std/time/struct.Instant.html" title="struct std::time::Instant">Instant</a>,
|
||
is_persistent_congestion: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,
|
||
lost_bytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>,
|
||
)</h4></section></summary><div class="docblock"><p>Packets were deemed lost or marked congested</p>
|
||
<p><code>in_persistent_congestion</code> indicates whether all packets sent within the persistent
|
||
congestion threshold period ending when the most recent packet in this batch was sent were
|
||
lost.
|
||
<code>lost_bytes</code> indicates how many bytes were lost. This value will be 0 for ECN triggers.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.on_mtu_update" class="method"><h4 class="code-header">fn <a href="#tymethod.on_mtu_update" class="fn">on_mtu_update</a>(&mut self, new_mtu: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a>)</h4></section></summary><div class="docblock"><p>The known MTU for the current network path has been updated</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.window" class="method"><h4 class="code-header">fn <a href="#tymethod.window" class="fn">window</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Number of ack-eliciting bytes that may be in flight</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.clone_box" class="method"><h4 class="code-header">fn <a href="#tymethod.clone_box" class="fn">clone_box</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="trait.Controller.html" title="trait iroh::endpoint::Controller">Controller</a>></h4></section></summary><div class="docblock"><p>Duplicate the controller’s state</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.initial_window" class="method"><h4 class="code-header">fn <a href="#tymethod.initial_window" class="fn">initial_window</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a></h4></section></summary><div class="docblock"><p>Initial congestion window</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.into_any" class="method"><h4 class="code-header">fn <a href="#tymethod.into_any" class="fn">into_any</a>(self: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><Self>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a><dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a>></h4></section></summary><div class="docblock"><p>Returns Self for use in down-casting to extract implementation details</p>
|
||
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.on_sent" class="method"><h4 class="code-header">fn <a href="#method.on_sent" class="fn">on_sent</a>(&mut self, now: <a class="struct" href="https://doc.rust-lang.org/nightly/std/time/struct.Instant.html" title="struct std::time::Instant">Instant</a>, bytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>, last_packet_number: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>)</h4></section></summary><div class="docblock"><p>One or more packets were just sent</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.on_ack" class="method"><h4 class="code-header">fn <a href="#method.on_ack" class="fn">on_ack</a>(
|
||
&mut self,
|
||
now: <a class="struct" href="https://doc.rust-lang.org/nightly/std/time/struct.Instant.html" title="struct std::time::Instant">Instant</a>,
|
||
sent: <a class="struct" href="https://doc.rust-lang.org/nightly/std/time/struct.Instant.html" title="struct std::time::Instant">Instant</a>,
|
||
bytes: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>,
|
||
app_limited: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,
|
||
rtt: &RttEstimator,
|
||
)</h4></section></summary><div class="docblock"><p>Packet deliveries were confirmed</p>
|
||
<p><code>app_limited</code> indicates whether the connection was blocked on outgoing
|
||
application data prior to receiving these acknowledgements.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.on_end_acks" class="method"><h4 class="code-header">fn <a href="#method.on_end_acks" class="fn">on_end_acks</a>(
|
||
&mut self,
|
||
now: <a class="struct" href="https://doc.rust-lang.org/nightly/std/time/struct.Instant.html" title="struct std::time::Instant">Instant</a>,
|
||
in_flight: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>,
|
||
app_limited: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>,
|
||
largest_packet_num_acked: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a><<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u64.html">u64</a>>,
|
||
)</h4></section></summary><div class="docblock"><p>Packets are acked in batches, all with the same <code>now</code> argument. This indicates one of those batches has completed.</p>
|
||
</div></details><details class="toggle method-toggle" open><summary><section id="method.metrics" class="method"><h4 class="code-header">fn <a href="#method.metrics" class="fn">metrics</a>(&self) -> ControllerMetrics</h4></section></summary><div class="docblock"><p>Retrieve implementation-specific metrics used to populate <code>qlog</code> traces when they are enabled</p>
|
||
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-Controller-for-Bbr" class="impl"><a href="#impl-Controller-for-Bbr" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Controller.html" title="trait iroh::endpoint::Controller">Controller</a> for Bbr</h3></section><section id="impl-Controller-for-Cubic" class="impl"><a href="#impl-Controller-for-Cubic" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Controller.html" title="trait iroh::endpoint::Controller">Controller</a> for Cubic</h3></section><section id="impl-Controller-for-NewReno" class="impl"><a href="#impl-Controller-for-NewReno" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.Controller.html" title="trait iroh::endpoint::Controller">Controller</a> for NewReno</h3></section></div><script src="../../trait.impl/iroh_quinn_proto/congestion/trait.Controller.js" data-ignore-extern-crates="iroh_quinn_proto" async></script></section></div></main></body></html> |