pub trait TransportRequest:
Clone
+ Send
+ Sync
+ Debug
+ Mockable {
type Client: TransportClient;
type Response: Mockable + Send + Debug;
const SETTINGS_OVERRIDES: RequestSettings;
// Required methods
fn method_name(&self) -> &'static str;
fn execute_transport<'c>(
self,
client: &'c mut Self::Client,
settings: &AppliedRequestSettings,
) -> BoxFuture<'c, Result<Self::Response, TransportError>>;
// Provided methods
fn request_name(&self) -> &'static str { ... }
fn response_name(&self) -> &'static str { ... }
fn names_nothing(&self) -> Option<&'static str> { ... }
fn needs_protocol_version(&self) -> Option<u32> { ... }
}Expand description
Generic transport layer request. Requires Clone as could be retried and a client in general consumes a request.
Required Associated Constants§
Sourceconst SETTINGS_OVERRIDES: RequestSettings
const SETTINGS_OVERRIDES: RequestSettings
Settings that will override DapiClient’s ones each time the request is executed.
Required Associated Types§
Sourcetype Client: TransportClient
type Client: TransportClient
A client specific to this type of transport.
Required Methods§
Sourcefn method_name(&self) -> &'static str
fn method_name(&self) -> &'static str
gRPC method name
Sourcefn execute_transport<'c>(
self,
client: &'c mut Self::Client,
settings: &AppliedRequestSettings,
) -> BoxFuture<'c, Result<Self::Response, TransportError>>
fn execute_transport<'c>( self, client: &'c mut Self::Client, settings: &AppliedRequestSettings, ) -> BoxFuture<'c, Result<Self::Response, TransportError>>
Perform transport request asynchronously.
Provided Methods§
Sourcefn request_name(&self) -> &'static str
fn request_name(&self) -> &'static str
gRPC request name
Sourcefn response_name(&self) -> &'static str
fn response_name(&self) -> &'static str
gRPC response name
Sourcefn names_nothing(&self) -> Option<&'static str>
fn names_nothing(&self) -> Option<&'static str>
When the request asks a proof of nothing (an empty id list), the INVALID_ARGUMENT message every node refuses it with. DapiClient then refuses it the same way without sending it: a node released before that refusal answers with an internal error, or with a proof of nothing the client cannot verify, and either one gets the node banned and the request sent to the next. Without a proof, nodes answer an empty list with an empty result, so the request is sent.
Sourcefn needs_protocol_version(&self) -> Option<u32>
fn needs_protocol_version(&self) -> Option<u32>
The lowest protocol version at which every node of a network serves this request as
asked. Below it some nodes run a release that does not know the request’s method or
one of its fields: they answer UNIMPLEMENTED, or drop the field and answer a different
question, and either gets them banned. None when nodes of every version serve it.
The SDK’s fetch paths refuse such a request until the network has proven that version; a caller that executes the request directly owns the check.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".