1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//! Async frame sinks used by the connection actor.
//!
//! The actor applies the composition it owns — correlation stamping, its
//! configured fragmenter, and its protocol hooks — before handing a frame to a
//! [`FrameSink`]. A sink may instead own part of that composition when the
//! actor is built without a fragmenter or `before_send` hook, which is how the
//! server connection keeps fragmentation, metrics, serialization, codec
//! wrapping, and `before_send` in one fixed order. The sink is awaited, so a
//! sink writing to a bounded transport transmits back-pressure to the actor's
//! data sources instead of buffering without limit.
use ;
use Notify;
use crate;
/// Renewal signal raised by a sink after each completed physical write.
///
/// The actor hands a sink one future per composed frame, but a transport may
/// turn that frame into several physical writes. Without a progress signal the
/// actor's idle grace would bound the whole frame, so a peer that accepts every
/// fragment slowly would still lose the response once the total transfer
/// outlived one grace. Reporting each accepted write lets the actor renew its
/// deadline, while a write that stops making progress still expires.
pub
/// Await the sink's next progress report.
///
/// A sink without a signal never makes progress observable, so the future stays
/// pending for the lifetime of the write: such a sink is bounded as a whole.
pub async
/// Destination for fully composed frames emitted by the connection actor.
///
/// Implementations receive a frame after the actor has applied its own
/// fragmenter and `before_send` hook, which are absent when the sink owns that
/// composition. [`send_frame`](Self::send_frame) is awaited before the actor
/// polls its sources again, which is what applies transport back-pressure to
/// producers.
pub
/// Destination for frames taken directly from a connection's push queues.
///
/// Push frames have a different shape from response frames when the server
/// drives a connection: responses are application [`Envelope`]s that the sink
/// serializes, while pushes arrive already encoded for the wire. The separate
/// trait keeps both kinds flowing through the same actor loop without forcing
/// either producer through the other's composition.
///
/// [`Envelope`]: crate::app::Envelope
pub
/// Buffered sink retaining emitted frames for inspection.
///
/// This backs the standalone [`ConnectionActor::run`] driver, so it counts
/// each physical frame as outbound. An integrated transport sink leaves that
/// accounting to the transport it wraps. The same buffer receives queued push
/// frames, because a standalone actor's pushes are composed into its response
/// frame type.
///
/// [`ConnectionActor::run`]: super::ConnectionActor::run