Commit b11e707
authored
feat(iroh)!: Retain stats for closed and abandoned paths in the path watcher (#3899)
## Description
Improves the path watcher for connections to reliably allow accessing
the stats of abandoned paths.
* Abandoned paths are not removed from the value of the watchable for a
connection's paths, as long as there are active watchers (subscribers)
* Only once all watchers are dropped, we drop the abandoned paths from
the watchable's value on the next update
* This means that if you keep a `PathWatcher` alive for the duration of
a connection, it will contain *all* paths the connection ever used.
* We use the changes from n0-computer/noq#386
and keep a `WeakPathHandle` for all paths in the watchable's value. This
prevents the path stats to be dropped within a quinn connection even if
the path is abandoned.
* We do no longer store path stats anywhere in iroh directly, but only
ever access them from quinn. Due to keeping the `WeakPathHandle`, we can
ensure that the stats are always available as long as the connection
hasn't been dropped.
The combination of all this gives us a reliable way to access final path
stats for all paths used in a connection, as long as you keep a
reference to the connection around, which is quite straightforward to do
and document.
## Breaking Changes
* `Connection::paths` and `ConnectionInfo::paths` now return a
`PathWatcher` (which still implements `n0_watcher::Watcher` but now also
is a named struct)
* `PathInfo::stats` and `PathInfo::rtt` now return `Option`. They return
`None` if the underlying connection has been droped.
## Notes & open questions
I spend quite some time going back-and-forth over different approaches.
Very open to other ideas, but I'm a bit out of further ideas currently
and this is the best I could come up with so far.
## Change checklist
<!-- Remove any that are not relevant. -->
- [ ] Self-review.
- [ ] Documentation updates following the [style
guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text),
if relevant.
- [ ] Tests if relevant.
- [ ] All breaking changes documented.
- [ ] List all breaking changes in the above "Breaking Changes" section.
- [ ] Open an issue or PR on any number0 repos that are affected by this
breaking change. Give guidance on how the updates should be handled or
do the actual updates themselves. The major ones are:
- [ ] [`quic-rpc`](https://github.com/n0-computer/quic-rpc)
- [ ] [`iroh-gossip`](https://github.com/n0-computer/iroh-gossip)
- [ ] [`iroh-blobs`](https://github.com/n0-computer/iroh-blobs)
- [ ] [`dumbpipe`](https://github.com/n0-computer/dumbpipe)
- [ ] [`sendme`](https://github.com/n0-computer/sendme)1 parent 1b4ee2a commit b11e707
10 files changed
Lines changed: 523 additions & 365 deletions
File tree
- iroh
- examples
- src
- endpoint
- socket
- remote_map
- remote_state
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
224 | 225 | | |
225 | 226 | | |
226 | 227 | | |
| |||
237 | 238 | | |
238 | 239 | | |
239 | 240 | | |
240 | | - | |
241 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
242 | 244 | | |
243 | 245 | | |
244 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
49 | 48 | | |
50 | 49 | | |
51 | 50 | | |
52 | | - | |
53 | | - | |
| 51 | + | |
| 52 | + | |
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
| |||
582 | 581 | | |
583 | 582 | | |
584 | 583 | | |
585 | | - | |
586 | | - | |
| 584 | + | |
| 585 | + | |
587 | 586 | | |
588 | 587 | | |
589 | 588 | | |
| |||
615 | 614 | | |
616 | 615 | | |
617 | 616 | | |
618 | | - | |
619 | | - | |
| 617 | + | |
620 | 618 | | |
621 | 619 | | |
622 | 620 | | |
| |||
658 | 656 | | |
659 | 657 | | |
660 | 658 | | |
| 659 | + | |
661 | 660 | | |
662 | | - | |
663 | | - | |
| 661 | + | |
664 | 662 | | |
665 | 663 | | |
666 | 664 | | |
| |||
706 | 704 | | |
707 | 705 | | |
708 | 706 | | |
709 | | - | |
710 | | - | |
| 707 | + | |
711 | 708 | | |
712 | 709 | | |
713 | 710 | | |
| |||
866 | 863 | | |
867 | 864 | | |
868 | 865 | | |
869 | | - | |
| 866 | + | |
870 | 867 | | |
871 | 868 | | |
872 | 869 | | |
| |||
878 | 875 | | |
879 | 876 | | |
880 | 877 | | |
| 878 | + | |
881 | 879 | | |
882 | | - | |
883 | 880 | | |
884 | 881 | | |
885 | 882 | | |
| |||
890 | 887 | | |
891 | 888 | | |
892 | 889 | | |
893 | | - | |
| 890 | + | |
894 | 891 | | |
895 | 892 | | |
896 | 893 | | |
| |||
902 | 899 | | |
903 | 900 | | |
904 | 901 | | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
913 | | - | |
914 | | - | |
915 | | - | |
916 | | - | |
917 | | - | |
918 | | - | |
919 | | - | |
920 | | - | |
921 | | - | |
922 | | - | |
923 | | - | |
924 | | - | |
925 | | - | |
926 | | - | |
927 | | - | |
928 | | - | |
929 | | - | |
930 | | - | |
931 | | - | |
932 | | - | |
933 | | - | |
934 | | - | |
935 | | - | |
936 | | - | |
937 | | - | |
938 | | - | |
939 | | - | |
940 | | - | |
941 | | - | |
942 | | - | |
943 | | - | |
944 | 902 | | |
945 | 903 | | |
946 | 904 | | |
| |||
1132 | 1090 | | |
1133 | 1091 | | |
1134 | 1092 | | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
1135 | 1113 | | |
1136 | 1114 | | |
1137 | 1115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
1677 | 1680 | | |
1678 | 1681 | | |
1679 | 1682 | | |
1680 | | - | |
1681 | | - | |
1682 | | - | |
| 1683 | + | |
1683 | 1684 | | |
1684 | 1685 | | |
| 1686 | + | |
1685 | 1687 | | |
1686 | 1688 | | |
1687 | 1689 | | |
| |||
1693 | 1695 | | |
1694 | 1696 | | |
1695 | 1697 | | |
1696 | | - | |
| 1698 | + | |
1697 | 1699 | | |
1698 | 1700 | | |
1699 | 1701 | | |
| |||
2193 | 2195 | | |
2194 | 2196 | | |
2195 | 2197 | | |
2196 | | - | |
| 2198 | + | |
2197 | 2199 | | |
2198 | 2200 | | |
2199 | 2201 | | |
| |||
3152 | 3154 | | |
3153 | 3155 | | |
3154 | 3156 | | |
3155 | | - | |
3156 | | - | |
3157 | | - | |
3158 | | - | |
3159 | | - | |
3160 | | - | |
3161 | | - | |
3162 | | - | |
3163 | | - | |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
| 3161 | + | |
| 3162 | + | |
| 3163 | + | |
| 3164 | + | |
| 3165 | + | |
| 3166 | + | |
| 3167 | + | |
3164 | 3168 | | |
3165 | 3169 | | |
3166 | 3170 | | |
| |||
3178 | 3182 | | |
3179 | 3183 | | |
3180 | 3184 | | |
3181 | | - | |
| 3185 | + | |
3182 | 3186 | | |
3183 | 3187 | | |
3184 | 3188 | | |
3185 | 3189 | | |
3186 | 3190 | | |
3187 | | - | |
| 3191 | + | |
3188 | 3192 | | |
3189 | 3193 | | |
3190 | 3194 | | |
3191 | 3195 | | |
3192 | | - | |
| 3196 | + | |
3193 | 3197 | | |
3194 | 3198 | | |
3195 | 3199 | | |
3196 | 3200 | | |
3197 | 3201 | | |
3198 | 3202 | | |
3199 | | - | |
| 3203 | + | |
3200 | 3204 | | |
3201 | 3205 | | |
3202 | 3206 | | |
3203 | 3207 | | |
3204 | 3208 | | |
3205 | 3209 | | |
3206 | | - | |
3207 | | - | |
3208 | | - | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
3209 | 3213 | | |
3210 | 3214 | | |
3211 | | - | |
3212 | | - | |
3213 | | - | |
| 3215 | + | |
| 3216 | + | |
| 3217 | + | |
3214 | 3218 | | |
3215 | 3219 | | |
3216 | | - | |
3217 | | - | |
3218 | | - | |
| 3220 | + | |
| 3221 | + | |
| 3222 | + | |
3219 | 3223 | | |
3220 | 3224 | | |
3221 | | - | |
3222 | | - | |
3223 | | - | |
| 3225 | + | |
| 3226 | + | |
| 3227 | + | |
3224 | 3228 | | |
3225 | 3229 | | |
3226 | 3230 | | |
| |||
0 commit comments