Struct StreamParams
pub struct StreamParams<M, F> {
pub sub: SubscriptionId,
pub method: &'static str,
pub limiter: Arc<BrokerLimiter>,
pub tokens: Arc<TokenManager>,
pub open: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = Result<Streaming<M>, Status>> + Send>> + Send + Sync>,
pub open_timeout: Duration,
pub wrap: Arc<dyn Fn(StreamEvent<M>) -> F + Send + Sync>,
pub tx: Sender<F>,
pub first: Option<Sender<Result<(), FinamError>>>,
}Expand description
Everything spawn_stream needs. M is the message type of the stream, F the frame type the
connector wants.
Fields§
§sub: SubscriptionIdThe subscription this stream serves. Only used for logging here.
method: &'static strLimiter key of the open call (SubscribeOrders, …).
limiter: Arc<BrokerLimiter>Rate limiter. A refused open waits for the time the limiter gives and tries again.
tokens: Arc<TokenManager>Token manager. The supervisor asks it for a renewal after UNAUTHENTICATED.
open: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = Result<Streaming<M>, Status>> + Send>> + Send + Sync>How to open the stream.
open_timeout: DurationHow long one open attempt may take before it counts as a failure.
wrap: Arc<dyn Fn(StreamEvent<M>) -> F + Send + Sync>Turns a StreamEvent into the connector’s frame.
tx: Sender<F>Where the frames go. When the receiver is gone, the supervisor ends.
first: Option<Sender<Result<(), FinamError>>>Receives the outcome of the FIRST open attempt, once. Used by subscribe_* to return a refusal.
Auto Trait Implementations§
impl<M, F> !RefUnwindSafe for StreamParams<M, F>
impl<M, F> !UnwindSafe for StreamParams<M, F>
impl<M, F> Freeze for StreamParams<M, F>
impl<M, F> Send for StreamParams<M, F>where
F: Send,
impl<M, F> Sync for StreamParams<M, F>where
F: Send,
impl<M, F> Unpin for StreamParams<M, F>
impl<M, F> UnsafeUnpin for StreamParams<M, F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
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].