This commit is contained in:
hinto.janai 2024-09-05 18:23:39 -04:00
parent d443cfb9b7
commit 9f8f2c7edf
No known key found for this signature in database
GPG key ID: D47CE05FA175A499
2 changed files with 11 additions and 6 deletions

View file

@ -2,8 +2,6 @@
//! //!
//! Will contain the code to initiate the RPC and a request handler. //! Will contain the code to initiate the RPC and a request handler.
// TODO: remove after impl.
mod bin; mod bin;
mod handler; mod handler;
mod json; mod json;

View file

@ -1,6 +1,6 @@
//! Dummy implementation of [`RpcHandler`]. //! Dummy implementation of [`RpcHandler`].
use std::task::Poll; use std::task::{Context, Poll};
use cuprate_rpc_types::{ use cuprate_rpc_types::{
bin::{BinRequest, BinResponse}, bin::{BinRequest, BinResponse},
@ -43,6 +43,13 @@ pub struct CupratedRpcHandlerState {
pub txpool: TxpoolReadHandle, pub txpool: TxpoolReadHandle,
} }
impl CupratedRpcHandler {
/// TODO
pub fn init() {
todo!()
}
}
impl RpcHandler for CupratedRpcHandler { impl RpcHandler for CupratedRpcHandler {
fn restricted(&self) -> bool { fn restricted(&self) -> bool {
self.restricted self.restricted
@ -54,7 +61,7 @@ impl Service<JsonRpcRequest> for CupratedRpcHandler {
type Error = RpcError; type Error = RpcError;
type Future = BoxFuture<'static, Result<JsonRpcResponse, RpcError>>; type Future = BoxFuture<'static, Result<JsonRpcResponse, RpcError>>;
fn poll_ready(&mut self, _: &mut std::task::Context<'_>) -> Poll<Result<(), Self::Error>> { fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(())) Poll::Ready(Ok(()))
} }
@ -69,7 +76,7 @@ impl Service<BinRequest> for CupratedRpcHandler {
type Error = RpcError; type Error = RpcError;
type Future = BoxFuture<'static, Result<BinResponse, RpcError>>; type Future = BoxFuture<'static, Result<BinResponse, RpcError>>;
fn poll_ready(&mut self, _: &mut std::task::Context<'_>) -> Poll<Result<(), Self::Error>> { fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(())) Poll::Ready(Ok(()))
} }
@ -84,7 +91,7 @@ impl Service<OtherRequest> for CupratedRpcHandler {
type Error = RpcError; type Error = RpcError;
type Future = BoxFuture<'static, Result<OtherResponse, RpcError>>; type Future = BoxFuture<'static, Result<OtherResponse, RpcError>>;
fn poll_ready(&mut self, _: &mut std::task::Context<'_>) -> Poll<Result<(), Self::Error>> { fn poll_ready(&mut self, _: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(())) Poll::Ready(Ok(()))
} }