Skip to main content

InterestOwnerSubscriber

Trait InterestOwnerSubscriber 

Source
pub trait InterestOwnerSubscriber<N: Network = Ethereum>: EventSubscriber<N> {
    // Required methods
    fn add_interest_owner(
        &mut self,
        owner: HandlerId,
        interests: &[ReactiveInterest<N>],
    ) -> Result<(), SubscriberError>;
    fn add_interest_owner_with_backfill(
        &mut self,
        owner: HandlerId,
        interests: &[ReactiveInterest<N>],
        backfill: SubscriberBackfill,
    ) -> Result<(), SubscriberError>;
    fn remove_interest_owner(
        &mut self,
        owner: &HandlerId,
    ) -> Option<Vec<ReactiveInterest<N>>>;
    fn owner_interests(
        &self,
        owner: &HandlerId,
    ) -> Option<&[ReactiveInterest<N>]>;
}
Expand description

Extension trait for subscribers that can add and remove handler-owned interests incrementally.

EventSubscriber::register_interests remains the full-replacement setup API. Implement this trait when a subscriber can preserve unrelated live sources and delivery state while one handler’s interests are added or removed. Implementations should make owner replacement continuity-safe: updating an owner’s interests must not silently discard delivery progress the previous interests had already established (the in-crate AlloySubscriber carries the owner’s prior delivery anchor over to changed filter shapes and automatically backfills the gap).

Required Methods§

Source

fn add_interest_owner( &mut self, owner: HandlerId, interests: &[ReactiveInterest<N>], ) -> Result<(), SubscriberError>

Add or replace the interests owned by owner.

Source

fn add_interest_owner_with_backfill( &mut self, owner: HandlerId, interests: &[ReactiveInterest<N>], backfill: SubscriberBackfill, ) -> Result<(), SubscriberError>

Add or replace owner interests and schedule log backfill for that owner.

Source

fn remove_interest_owner( &mut self, owner: &HandlerId, ) -> Option<Vec<ReactiveInterest<N>>>

Remove one owner’s interests, preserving unrelated interests.

Source

fn owner_interests(&self, owner: &HandlerId) -> Option<&[ReactiveInterest<N>]>

Borrow the interests currently owned by owner.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<P, N> InterestOwnerSubscriber<N> for AlloySubscriber<P, N>
where P: Provider<N> + Send + Sync, N: Network + 'static, N::HeaderResponse: Send + 'static,