Module request_response_factory

Source
Expand description

Collection of request-response protocols.

The [RequestResponse] struct defined in this module provides support for zero or more so-called “request-response” protocols.

A request-response protocol works in the following way:

  • For every emitted request, a new substream is open and the protocol is negotiated. If the remote supports the protocol, the size of the request is sent as a LEB128 number, followed with the request itself. The remote then sends the size of the response as a LEB128 number, followed with the response.

  • Requests have a certain time limit before they time out. This time includes the time it takes to send/receive the request and response.

  • If provided, a “requests processing” channel is used to handle incoming requests.

Original file commit: https://github.com/paritytech/substrate/commit/c2fc4b3ca0d7a15cc3f9cb1e5f441d99ec8d6e0b

Structs§

IncomingRequest
A single request received by a peer on a request-response protocol.
OutgoingResponse
Response for an incoming request to be send by a request protocol handler.
ProtocolConfig
Configuration for a single request-response protocol.
RequestResponseFactoryBehaviour
Implementation of NetworkBehaviour that provides support for multiple request-response protocols.

Enums§

Event
Event generated by the RequestResponseFactoryBehaviour.
IfDisconnected
When sending a request, what to do on a disconnected recipient.
InboundFailure
Possible failures occurring in the context of receiving an inbound request and sending a response.
OutboundFailure
Possible failures occurring in the context of sending an outbound request and receiving the response.
RegisterError
Error when registering a protocol.
RequestFailure
Error in a request.
ResponseFailure
Error when processing a request sent by a remote.

Traits§

RequestHandler
Defines a handler for the request-response protocol factory.