remove unused things
This commit is contained in:
parent
e2ff199d82
commit
1e707251ef
@ -6,7 +6,6 @@ use axum::body::StreamBody;
|
|||||||
use axum::response::IntoResponse;
|
use axum::response::IntoResponse;
|
||||||
use axum::Json;
|
use axum::Json;
|
||||||
use bytes::{Bytes, BytesMut};
|
use bytes::{Bytes, BytesMut};
|
||||||
use derivative::Derivative;
|
|
||||||
use futures_util::stream::{self, StreamExt};
|
use futures_util::stream::{self, StreamExt};
|
||||||
use futures_util::TryStreamExt;
|
use futures_util::TryStreamExt;
|
||||||
use serde::{de, Deserialize, Serialize};
|
use serde::{de, Deserialize, Serialize};
|
||||||
@ -20,7 +19,7 @@ pub trait JsonRpcResultData = serde::Serialize + serde::de::DeserializeOwned + f
|
|||||||
|
|
||||||
/// TODO: borrow values to avoid allocs if possible
|
/// TODO: borrow values to avoid allocs if possible
|
||||||
/// TODO: lots of overlap with `SingleForwardedResponse`
|
/// TODO: lots of overlap with `SingleForwardedResponse`
|
||||||
#[derive(Clone, Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
pub struct ParsedResponse<T = Arc<RawValue>> {
|
pub struct ParsedResponse<T = Arc<RawValue>> {
|
||||||
pub jsonrpc: String,
|
pub jsonrpc: String,
|
||||||
pub id: Box<RawValue>,
|
pub id: Box<RawValue>,
|
||||||
@ -201,13 +200,11 @@ pub enum ResponsePayload<T> {
|
|||||||
Error { error: JsonRpcErrorData },
|
Error { error: JsonRpcErrorData },
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Derivative)]
|
#[derive(Debug)]
|
||||||
#[derivative(Debug)]
|
|
||||||
pub struct StreamResponse<T> {
|
pub struct StreamResponse<T> {
|
||||||
_t: PhantomData<T>,
|
_t: PhantomData<T>,
|
||||||
buffer: Bytes,
|
buffer: Bytes,
|
||||||
num_bytes: Option<u64>,
|
num_bytes: Option<u64>,
|
||||||
#[derivative(Debug = "ignore")]
|
|
||||||
response: reqwest::Response,
|
response: reqwest::Response,
|
||||||
web3_request: Arc<ValidatedRequest>,
|
web3_request: Arc<ValidatedRequest>,
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,6 @@ pub type JsonRpcResponseCache = Cache<u64, ForwardedResponse<Arc<RawValue>>>;
|
|||||||
/// TODO: think about this more. there is a lot of overlap with ParsedResponse
|
/// TODO: think about this more. there is a lot of overlap with ParsedResponse
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub enum ForwardedResponse<T> {
|
pub enum ForwardedResponse<T> {
|
||||||
NullResult,
|
|
||||||
Result {
|
Result {
|
||||||
value: T,
|
value: T,
|
||||||
num_bytes: u64,
|
num_bytes: u64,
|
||||||
@ -105,7 +104,6 @@ pub enum ForwardedResponse<T> {
|
|||||||
impl<R> ForwardedResponse<R> {
|
impl<R> ForwardedResponse<R> {
|
||||||
pub fn num_bytes(&self) -> u64 {
|
pub fn num_bytes(&self) -> u64 {
|
||||||
match self {
|
match self {
|
||||||
Self::NullResult => 1,
|
|
||||||
Self::Result { num_bytes, .. } => *num_bytes,
|
Self::Result { num_bytes, .. } => *num_bytes,
|
||||||
Self::RpcError { num_bytes, .. } => *num_bytes,
|
Self::RpcError { num_bytes, .. } => *num_bytes,
|
||||||
}
|
}
|
||||||
@ -113,7 +111,6 @@ impl<R> ForwardedResponse<R> {
|
|||||||
|
|
||||||
pub fn is_error(&self) -> bool {
|
pub fn is_error(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
Self::NullResult => false,
|
|
||||||
Self::Result { .. } => false,
|
Self::Result { .. } => false,
|
||||||
Self::RpcError { .. } => true,
|
Self::RpcError { .. } => true,
|
||||||
}
|
}
|
||||||
@ -122,14 +119,13 @@ impl<R> ForwardedResponse<R> {
|
|||||||
|
|
||||||
impl<R> ForwardedResponse<Option<R>> {
|
impl<R> ForwardedResponse<Option<R>> {
|
||||||
pub fn is_null(&self) -> bool {
|
pub fn is_null(&self) -> bool {
|
||||||
matches!(self, Self::NullResult | Self::Result { value: None, .. })
|
matches!(self, Self::Result { value: None, .. })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ForwardedResponse<Arc<RawValue>> {
|
impl ForwardedResponse<Arc<RawValue>> {
|
||||||
pub fn is_null(&self) -> bool {
|
pub fn is_null(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
Self::NullResult => true,
|
|
||||||
Self::Result { value, .. } => value.get() == "null",
|
Self::Result { value, .. } => value.get() == "null",
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user