Expand description
This crate contains a general request-response protocol. It is used to send requests to a set of recipients and wait for responses.
Modulesยง
- data_
source - The data source trait. Is what we use to derive the response data for a request
This file contains the
DataSourcetrait. This trait allows the [RequestResponseProtocol] to calculate/derive a response for a specific request. In the confirmation layer the implementer would be something like a [FeeMerkleTree] for fee catchup - message
- The message type. Is the base type for all messages in the request-response protocol
- network
- The network traits. Is what we use to send and receive messages over the network as
the protocol
This file contains the
SenderandReceivertraits. These traits are used by the [RequestResponseProtocol] to send and receive messages from a network or other source. - recipient_
source - The recipient source trait. Is what we use to get the recipients that a specific message should expect responses from
- request
- The request trait. Is what we use to define a request and a corresponding response type
This file contains the
Requestand [Response] traits. Any upstream that wants to use the [RequestResponseProtocol] needs to implement these traits for their specific types. - util ๐
- Utility types and functions
Structsยง
- Request
Response - A protocol that allows for request-response communication. Is cheaply cloneable, so there is no
need to wrap it in an
Arc - Request
Response Config - The underlying configuration for the request-response protocol
- Request
Response Inner - The inner implementation for the request-response protocol
- Response
Receiver ๐ - Receives candidate responses for one
RequestResponseInner::requestcall. Deregisters the waiter when dropped, so map entries are cleaned up on success, timeout, and cancellation alike - Waiter ๐
- A waiter registered by one
RequestResponseInner::requestcall, to which incoming responses for its request hash are delivered
Enumsยง
- Request
Error - The errors that can occur when making a request for data
Constantsยง
- RESPONSE_
BUFFER_ ๐SIZE - The number of serialized responses each waiter buffers before drops occur. Only one valid response is needed and batched senders keep re-requesting, so extra responses are free to drop. Kept small because bodies (leaves, merkle trees, VID shares) can be large and every in-flight request pins its own buffer
Traitsยง
- Serializable
- A trait for serializing and deserializing a type to and from a byte array.
Requesttypes and [Response] types will need to implement this trait
Type Aliasesยง
- Active
Requests ๐Map - The map of active outgoing requests: request hash โ the waiters registered by concurrent
RequestResponseInner::requestcalls for the same data. Guarded by a synchronous lock so waiters can deregister themselves inDrop; it is never held across anawait - Incoming
Requests - A type alias for the list of tasks that are responding to requests
- Request
Hash - A type alias for the hash of a request