Crate request_response

Source
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 DataSource trait. 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 Sender and Receiver traits. 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 Request and [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ยง

OutgoingRequest
An outgoing request. This is what we use to track a request and its corresponding response in the protocol
OutgoingRequestInner
The inner implementation of an outgoing request
RequestResponse
A protocol that allows for request-response communication. Is cheaply cloneable, so there is no need to wrap it in an Arc
RequestResponseConfig
The underlying configuration for the request-response protocol
RequestResponseInner
The inner implementation for the request-response protocol

Enumsยง

RequestError
The errors that can occur when making a request for data
RequestType
The type of request to make

Traitsยง

Serializable
A trait for serializing and deserializing a type to and from a byte array. Request types and [Response] types will need to implement this trait

Type Aliasesยง

IncomingRequests
A type alias for the list of tasks that are responding to requests
IncomingResponses
A type alias for the list of tasks that are validating incoming responses
OutgoingRequestsMap
A type alias for the outgoing requests map
RequestHash
A type alias for the hash of a request
ResponseValidationFn ๐Ÿ”’
A type alias for the function that returns the above future
ResponseValidationFuture ๐Ÿ”’
A type alias for the future that validates a response
ThreadSafeAny ๐Ÿ”’
A type alias for an Arc<dyn Any + Send + Sync + 'static>