Skip to main content

Shared

Struct Shared 

Source
struct Shared {
    control: Sender<Frame>,
    data: Sender<QueuedData>,
    streams: Mutex<HashMap<u32, StreamState>>,
    budget: Budget,
    resets: Mutex<Vec<u32>>,
    resets_ready: Notify,
    closing: CancellationToken,
    done: CancellationToken,
    activity: Activity,
    written: Activity,
    last_stream_id: AtomicU32,
    live_streams: AtomicUsize,
}
Expand description

What the reader, the writer and the streams of a connection share.

Fields§

§control: Sender<Frame>§data: Sender<QueuedData>§streams: Mutex<HashMap<u32, StreamState>>§budget: Budget

The bytes of the client all streams hold, see DATA_BUFFER.

§resets: Mutex<Vec<u32>>

The streams the server reset without queued data, which the writer sends next. Unlike the control queue it cannot be full, a stream gets reset only once.

§resets_ready: Notify§closing: CancellationToken

Cancelled once the server closes the connection after the frames queued until then.

§done: CancellationToken

Cancelled once the connection ended.

§activity: Activity

When the last frame got read or written, for the idle timeout.

§written: Activity

When a part of the frames of the server went out the last time, see ConnectionHandle::written.

§last_stream_id: AtomicU32

The last stream the client opened, for the GOAWAY.

§live_streams: AtomicUsize

The streams the server holds, see Live.

Implementations§

Source§

impl Shared

Source

fn lock_streams(&self) -> MutexGuard<'_, HashMap<u32, StreamState>>

Source

fn queue_reset(&self, id: u32)

Queue the reset of a stream for the writer.

Source

fn take_resets(&self) -> Vec<u32>

Source

fn remote_closed(&self, id: u32)

The client closed its side of the stream.

Source

fn local_closed(&self, id: u32)

The server closed its side of the stream.

Source

async fn deliver(&self, stream_id: u32, data: Bytes)

Hand the data of the client to its stream. Waits while the stream does not take it or the streams hold all of the budget, which stops reading the connection.

Source

async fn send_control(&self, frame: Frame) -> Result<()>

Source

fn go_away(&self, status: u32)

End the connection with a GOAWAY, which the writer sends on its way out unless the client does not read anymore.

Source

fn remove(&self, id: u32)

Forget a stream which got reset by either side.

Source

fn has_room(&self) -> bool

Whether the client may open another stream, see MAX_STREAMS.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more