[][src]Trait libp2p_gossipsub::subscription_filter::TopicSubscriptionFilter

pub trait TopicSubscriptionFilter {
    pub fn can_subscribe(&mut self, topic_hash: &TopicHash) -> bool;

    pub fn filter_incoming_subscriptions<'a>(
        &mut self,
        subscriptions: &'a [GossipsubSubscription],
        currently_subscribed_topics: &BTreeSet<TopicHash>
    ) -> Result<HashSet<&'a GossipsubSubscription>, String> { ... }
pub fn filter_incoming_subscription_set<'a>(
        &mut self,
        mut subscriptions: HashSet<&'a GossipsubSubscription>,
        _currently_subscribed_topics: &BTreeSet<TopicHash>
    ) -> Result<HashSet<&'a GossipsubSubscription>, String> { ... }
pub fn allow_incoming_subscription(
        &mut self,
        subscription: &GossipsubSubscription
    ) -> bool { ... } }

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.

Loading content...

Provided methods

pub fn filter_incoming_subscriptions<'a>(
    &mut self,
    subscriptions: &'a [GossipsubSubscription],
    currently_subscribed_topics: &BTreeSet<TopicHash>
) -> Result<HashSet<&'a GossipsubSubscription>, String>
[src]

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]

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]

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.

Loading content...

Implementors

impl TopicSubscriptionFilter for AllowAllSubscriptionFilter[src]

impl TopicSubscriptionFilter for WhitelistSubscriptionFilter[src]

impl<T> TopicSubscriptionFilter for CallbackSubscriptionFilter<T> where
    T: FnMut(&TopicHash) -> bool
[src]

impl<T, S> TopicSubscriptionFilter for CombinedSubscriptionFilters<T, S> where
    T: TopicSubscriptionFilter,
    S: TopicSubscriptionFilter
[src]

impl<T: TopicSubscriptionFilter> TopicSubscriptionFilter for MaxCountSubscriptionFilter<T>[src]

Loading content...