Trait ethcore_light::net::Handler [] [src]

pub trait Handler: Send + Sync {
    fn on_connect(&self,
              _ctx: &EventContext,
              _status: &Status,
              _capabilities: &Capabilities) { ... } fn on_disconnect(&self, _ctx: &EventContext, _unfulfilled: &[ReqId]) { ... } fn on_announcement(&self, _ctx: &EventContext, _announcement: &Announcement) { ... } fn on_transactions(&self, _ctx: &EventContext, _relay: &[UnverifiedTransaction]) { ... } fn on_block_bodies(&self,
                   _ctx: &EventContext,
                   _req_id: ReqId,
                   _bodies: &[Bytes]) { ... } fn on_block_headers(&self,
                    _ctx: &EventContext,
                    _req_id: ReqId,
                    _headers: &[Bytes]) { ... } fn on_receipts(&self,
               _ctx: &EventContext,
               _req_id: ReqId,
               _receipts: &[Vec<Receipt>]) { ... } fn on_state_proofs(&self,
                   _ctx: &EventContext,
                   _req_id: ReqId,
                   _proofs: &[Vec<Bytes>]) { ... } fn on_code(&self, _ctx: &EventContext, _req_id: ReqId, _codes: &[Bytes]) { ... } fn on_header_proofs(&self,
                    _ctx: &EventContext,
                    _req_id: ReqId,
                    _proofs: &[(Bytes, Vec<Bytes>)]) { ... } fn tick(&self, _ctx: &BasicContext) { ... } fn on_abort(&self) { ... } }

An LES event handler.

Each handler function takes a context which describes the relevant peer and gives references to the IO layer and protocol structure so new messages can be dispatched immediately.

Request responses are not guaranteed to be complete or valid, but passed IDs will be correct. Response handlers are not given a copy of the original request; it is assumed that relevant data will be stored by interested handlers.

Provided Methods

Called when a peer connects.

Called when a peer disconnects, with a list of unfulfilled request IDs as of yet.

Called when a peer makes an announcement.

Called when a peer requests relay of some transactions.

Called when a peer responds with block bodies.

Called when a peer responds with block headers.

Called when a peer responds with block receipts.

Called when a peer responds with state proofs. Each proof should be a series of trie nodes in ascending order by distance from the root.

Called when a peer responds with contract code.

Called when a peer responds with header proofs. Each proof should be a block header coupled with a series of trie nodes is ascending order by distance from the root.

Called to "tick" the handler periodically.

Called on abort. This signals to handlers that they should clean up and ignore peers.

Implementors