Struct Registry
pub struct Registry<K> { /* private fields */ }Expand description
The subscriptions of a core, their topics and the state of each topic.
Several subscriptions may listen to one topic (two bots, or a quote stream and a book of depth 1): the exchange is asked once, the frames go to all of them.
Implementations§
§impl<K> Registry<K>
impl<K> Registry<K>
pub fn notifier(&self) -> Arc<Notify> ⓘ
pub fn notifier(&self) -> Arc<Notify> ⓘ
Woken whenever a topic changes state. The connector waits on it for the confirmation of a new subscription.
pub fn register(&mut self, id: SubscriptionId, kind: K, topics: Vec<String>)
pub fn register(&mut self, id: SubscriptionId, kind: K, topics: Vec<String>)
Registers a subscription for topics. A topic that already has subscriptions keeps its state.
pub fn add_request(&mut self, req_id: &str, topic: &str)
pub fn add_request(&mut self, req_id: &str, topic: &str)
Remembers that the answer carrying req_id is about topic.
pub fn forget(&mut self, id: SubscriptionId) -> Vec<String>
pub fn forget(&mut self, id: SubscriptionId) -> Vec<String>
Forgets a subscription. Returns the topics nobody listens to any more.
pub fn topic_active(&self, topic: &str) -> bool
pub fn topic_active(&self, topic: &str) -> bool
Whether the exchange has confirmed the topic.
pub fn state(&self, id: SubscriptionId) -> Option<(SubState, Option<String>)>
pub fn state(&self, id: SubscriptionId) -> Option<(SubState, Option<String>)>
The state of a subscription: failed when any topic was refused, active when all are, else pending. With the reason of the refusal.
pub fn on_ack(&mut self, req_id: &str, success: bool, message: &str)
pub fn on_ack(&mut self, req_id: &str, success: bool, message: &str)
An answer of the exchange to a subscription request.
pub fn fail_pending(&mut self, reason: &str)
pub fn fail_pending(&mut self, reason: &str)
The login was refused: every topic still waiting fails with the reason.
pub fn reset(&mut self)
pub fn reset(&mut self)
A connection was lost and made again: every topic is asked for again and waits for its answer.
Trait Implementations§
Auto Trait Implementations§
impl<K> Freeze for Registry<K>
impl<K> RefUnwindSafe for Registry<K>where
K: RefUnwindSafe,
impl<K> Send for Registry<K>where
K: Send,
impl<K> Sync for Registry<K>where
K: Sync,
impl<K> Unpin for Registry<K>where
K: Unpin,
impl<K> UnsafeUnpin for Registry<K>
impl<K> UnwindSafe for Registry<K>where
K: UnwindSafe,
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
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>
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>,
Layered].