Skip to main content

SubscriptionManagerProtocol

Trait SubscriptionManagerProtocol 

Source
pub trait SubscriptionManagerProtocol: Send + Sync {
    // Required methods
    fn new_head(&self, header: BlockHeader) -> Result<(), ActorError>;
    fn subscribe(&self, sender: Sender<String>) -> Response<Option<String>>;
    fn unsubscribe(&self, id: String) -> Response<bool>;
}
Expand description

Messages understood by the SubscriptionManager.

Required Methods§

Source

fn new_head(&self, header: BlockHeader) -> Result<(), ActorError>

Broadcast a new block header to all newHeads subscribers.

The actor handles serialization and hash injection. Callers just pass the raw BlockHeader. Dead subscribers are removed automatically when their channel is closed.

Source

fn subscribe(&self, sender: Sender<String>) -> Response<Option<String>>

Register a new subscriber.

Returns Some(id) with the subscription ID that the client should use in subsequent eth_unsubscribe calls, or None if the global cap MAX_TOTAL_SUBSCRIPTIONS has been reached.

Source

fn unsubscribe(&self, id: String) -> Response<bool>

Remove a subscriber by ID.

Returns true if the subscription existed and was removed, false otherwise.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<__A: Actor + Handler<NewHead> + Handler<Subscribe> + Handler<Unsubscribe>> SubscriptionManagerProtocol for ActorRef<__A>

Source§

fn new_head(&self, header: BlockHeader) -> Result<(), ActorError>

Broadcast a new block header to all newHeads subscribers.

The actor handles serialization and hash injection. Callers just pass the raw BlockHeader. Dead subscribers are removed automatically when their channel is closed.

Source§

fn subscribe(&self, sender: Sender<String>) -> Response<Option<String>>

Register a new subscriber.

Returns Some(id) with the subscription ID that the client should use in subsequent eth_unsubscribe calls, or None if the global cap MAX_TOTAL_SUBSCRIPTIONS has been reached.

Source§

fn unsubscribe(&self, id: String) -> Response<bool>

Remove a subscriber by ID.

Returns true if the subscription existed and was removed, false otherwise.

Source§

impl<__A: Actor + Handler<NewHead> + Handler<Subscribe> + Handler<Unsubscribe>> SubscriptionManagerProtocol for ActorRef<__A>

Source§

fn new_head(&self, header: BlockHeader) -> Result<(), ActorError>

Broadcast a new block header to all newHeads subscribers.

The actor handles serialization and hash injection. Callers just pass the raw BlockHeader. Dead subscribers are removed automatically when their channel is closed.

Source§

fn subscribe(&self, sender: Sender<String>) -> Response<Option<String>>

Register a new subscriber.

Returns Some(id) with the subscription ID that the client should use in subsequent eth_unsubscribe calls, or None if the global cap MAX_TOTAL_SUBSCRIPTIONS has been reached.

Source§

fn unsubscribe(&self, id: String) -> Response<bool>

Remove a subscriber by ID.

Returns true if the subscription existed and was removed, false otherwise.

Implementors§