pub struct SubscriptionHandler<'a, S: Db> { /* private fields */ }Implementations§
Source§impl<'a, S: Db> SubscriptionHandler<'a, S>
impl<'a, S: Db> SubscriptionHandler<'a, S>
pub fn new(db: &'a S) -> Self
Sourcepub fn init(
&self,
txn: &mut <S as Db>::RwTx<'_>,
introduction: Introduction,
) -> Result<()>
pub fn init( &self, txn: &mut <S as Db>::RwTx<'_>, introduction: Introduction, ) -> Result<()>
Loads the subscriptions from a software agent introduction
Sourcepub fn subscribe(&self, subscriber: AgentId, topic: Topic) -> Result<()>
pub fn subscribe(&self, subscriber: AgentId, topic: Topic) -> Result<()>
Subscribes an [‘AgentId’] to a topic from a specific publisher
The changes are automatically commited to DB
Sourcepub fn unsubscribe(&self, subscriber: AgentId, topic: Topic) -> Result<()>
pub fn unsubscribe(&self, subscriber: AgentId, topic: Topic) -> Result<()>
Unsubscribes an [‘AgentId’] from a topic
The changes are automatically commited to DB
Sourcepub fn get_topic_subscribers(
&self,
publisher: Id,
topic: String,
) -> Result<Vec<(AgentId, String)>>
pub fn get_topic_subscribers( &self, publisher: Id, topic: String, ) -> Result<Vec<(AgentId, String)>>
Fetches the active subscribers for a full topic (publisher + topic)
Sourcepub fn get_subscriptions(&self, target: AgentId) -> Result<Vec<Topic>>
pub fn get_subscriptions(&self, target: AgentId) -> Result<Vec<Topic>>
Fetches all active subscriptions for the specified [‘AgentId’]
pub fn unsubscribe_all( &self, txn: &mut <S as Db>::RwTx<'_>, subscriber: Id, ) -> Result<()>
Auto Trait Implementations§
impl<'a, S> Freeze for SubscriptionHandler<'a, S>
impl<'a, S> RefUnwindSafe for SubscriptionHandler<'a, S>where
S: RefUnwindSafe,
impl<'a, S> Send for SubscriptionHandler<'a, S>
impl<'a, S> Sync for SubscriptionHandler<'a, S>
impl<'a, S> Unpin for SubscriptionHandler<'a, S>
impl<'a, S> UnsafeUnpin for SubscriptionHandler<'a, S>
impl<'a, S> UnwindSafe for SubscriptionHandler<'a, S>where
S: RefUnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more