moved rust-evmjit -> evmjit, added clippy and basic docs to rpc crate
This commit is contained in:
@@ -15,4 +15,5 @@ jsonrpc-core = "1.1"
|
||||
jsonrpc-http-server = "1.1"
|
||||
ethcore-util = { path = "../util" }
|
||||
ethcore = { path = ".." }
|
||||
clippy = "0.0.37"
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
//! Eth rpc implementation.
|
||||
use std::sync::Arc;
|
||||
use jsonrpc_core::*;
|
||||
use util::hash::*;
|
||||
@@ -8,11 +9,13 @@ use ethcore::views::*;
|
||||
use traits::{Eth, EthFilter};
|
||||
use types::Block;
|
||||
|
||||
/// Eth rpc implementation.
|
||||
pub struct EthClient {
|
||||
client: Arc<Client>,
|
||||
}
|
||||
|
||||
impl EthClient {
|
||||
/// Creates new EthClient.
|
||||
pub fn new(client: Arc<Client>) -> Self {
|
||||
EthClient {
|
||||
client: client
|
||||
@@ -100,11 +103,13 @@ impl Eth for EthClient {
|
||||
}
|
||||
}
|
||||
|
||||
/// Eth filter rpc implementation.
|
||||
pub struct EthFilterClient {
|
||||
client: Arc<Client>
|
||||
}
|
||||
|
||||
impl EthFilterClient {
|
||||
/// Creates new Eth filter client.
|
||||
pub fn new(client: Arc<Client>) -> Self {
|
||||
EthFilterClient {
|
||||
client: client
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
use jsonrpc_core::*;
|
||||
use traits::Net;
|
||||
|
||||
/// Net rpc implementation.
|
||||
pub struct NetClient;
|
||||
|
||||
impl NetClient {
|
||||
/// Creates new NetClient.
|
||||
pub fn new() -> Self { NetClient }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
//! Web3 rpc implementation.
|
||||
use jsonrpc_core::*;
|
||||
use traits::Web3;
|
||||
|
||||
/// Web3 rpc implementation.
|
||||
pub struct Web3Client;
|
||||
|
||||
impl Web3Client {
|
||||
/// Creates new Web3Client.
|
||||
pub fn new() -> Self { Web3Client }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
//! Ethcore rpc.
|
||||
#![warn(missing_docs)]
|
||||
#![feature(custom_derive, custom_attribute, plugin)]
|
||||
#![feature(slice_patterns)]
|
||||
#![plugin(serde_macros)]
|
||||
#![plugin(clippy)]
|
||||
|
||||
extern crate serde;
|
||||
extern crate serde_json;
|
||||
@@ -22,12 +24,14 @@ mod types;
|
||||
pub use self::traits::{Web3, Eth, EthFilter, Net};
|
||||
pub use self::impls::*;
|
||||
|
||||
/// Http server.
|
||||
pub struct HttpServer {
|
||||
handler: IoHandler,
|
||||
threads: usize
|
||||
}
|
||||
|
||||
impl HttpServer {
|
||||
/// Construct new http server object with given number of threads.
|
||||
pub fn new(threads: usize) -> HttpServer {
|
||||
HttpServer {
|
||||
handler: IoHandler::new(),
|
||||
@@ -35,10 +39,12 @@ impl HttpServer {
|
||||
}
|
||||
}
|
||||
|
||||
/// Add io delegate.
|
||||
pub fn add_delegate<D>(&mut self, delegate: IoDelegate<D>) where D: Send + Sync + 'static {
|
||||
self.handler.add_delegate(delegate);
|
||||
}
|
||||
|
||||
/// Start server asynchronously in new thread
|
||||
pub fn start_async(self, addr: &str) {
|
||||
let server = jsonrpc_http_server::Server::new(self.handler, self.threads);
|
||||
server.start_async(addr)
|
||||
|
||||
@@ -44,6 +44,7 @@ pub trait Eth: Sized + Send + Sync + 'static {
|
||||
}
|
||||
}
|
||||
|
||||
/// Eth filters rpc api (polling).
|
||||
// TODO: do filters api properly
|
||||
pub trait EthFilter: Sized + Send + Sync + 'static {
|
||||
/// Returns id of new block filter
|
||||
|
||||
Reference in New Issue
Block a user