[−][src]Trait libp2p_gossipsub::subscription_filter::TopicSubscriptionFilter
Required methods
pub fn can_subscribe(&mut self, topic_hash: &TopicHash) -> bool
[src]
Returns true iff the topic is of interest and we can subscribe to it.
Provided methods
pub fn filter_incoming_subscriptions<'a>(
&mut self,
subscriptions: &'a [GossipsubSubscription],
currently_subscribed_topics: &BTreeSet<TopicHash>
) -> Result<HashSet<&'a GossipsubSubscription>, String>
[src]
&mut self,
subscriptions: &'a [GossipsubSubscription],
currently_subscribed_topics: &BTreeSet<TopicHash>
) -> Result<HashSet<&'a GossipsubSubscription>, String>
Filters a list of incoming subscriptions and returns a filtered set
By default this deduplicates the subscriptions and calls
Self::filter_incoming_subscription_set
on the filtered set.
pub fn filter_incoming_subscription_set<'a>(
&mut self,
mut subscriptions: HashSet<&'a GossipsubSubscription>,
_currently_subscribed_topics: &BTreeSet<TopicHash>
) -> Result<HashSet<&'a GossipsubSubscription>, String>
[src]
&mut self,
mut subscriptions: HashSet<&'a GossipsubSubscription>,
_currently_subscribed_topics: &BTreeSet<TopicHash>
) -> Result<HashSet<&'a GossipsubSubscription>, String>
Filters a set of deduplicated subscriptions
By default this filters the elements based on Self::allow_incoming_subscription
.
pub fn allow_incoming_subscription(
&mut self,
subscription: &GossipsubSubscription
) -> bool
[src]
&mut self,
subscription: &GossipsubSubscription
) -> bool
Returns true iff we allow an incoming subscription. This is used by the default implementation of filter_incoming_subscription_set to decide whether to filter out a subscription or not. By default this uses can_subscribe to decide the same for incoming subscriptions as for outgoing ones.
Implementors
impl TopicSubscriptionFilter for AllowAllSubscriptionFilter
[src]
pub fn can_subscribe(&mut self, _: &TopicHash) -> bool
[src]
impl TopicSubscriptionFilter for WhitelistSubscriptionFilter
[src]
pub fn can_subscribe(&mut self, topic_hash: &TopicHash) -> bool
[src]
impl<T> TopicSubscriptionFilter for CallbackSubscriptionFilter<T> where
T: FnMut(&TopicHash) -> bool,
[src]
T: FnMut(&TopicHash) -> bool,
pub fn can_subscribe(&mut self, topic_hash: &TopicHash) -> bool
[src]
impl<T, S> TopicSubscriptionFilter for CombinedSubscriptionFilters<T, S> where
T: TopicSubscriptionFilter,
S: TopicSubscriptionFilter,
[src]
T: TopicSubscriptionFilter,
S: TopicSubscriptionFilter,
pub fn can_subscribe(&mut self, topic_hash: &TopicHash) -> bool
[src]
pub fn filter_incoming_subscription_set<'a>(
&mut self,
subscriptions: HashSet<&'a GossipsubSubscription>,
currently_subscribed_topics: &BTreeSet<TopicHash>
) -> Result<HashSet<&'a GossipsubSubscription>, String>
[src]
&mut self,
subscriptions: HashSet<&'a GossipsubSubscription>,
currently_subscribed_topics: &BTreeSet<TopicHash>
) -> Result<HashSet<&'a GossipsubSubscription>, String>