moved rust-evmjit -> evmjit, added clippy and basic docs to rpc crate

This commit is contained in:
debris 2016-01-27 17:08:59 +01:00
parent f7a0f10568
commit 61c64d264b
12 changed files with 21 additions and 4 deletions

View File

@ -17,7 +17,7 @@ heapsize = "0.2.0"
rust-crypto = "0.2.34" rust-crypto = "0.2.34"
time = "0.1" time = "0.1"
#interpolate_idents = { git = "https://github.com/SkylerLipthay/interpolate_idents" } #interpolate_idents = { git = "https://github.com/SkylerLipthay/interpolate_idents" }
evmjit = { path = "rust-evmjit", optional = true } evmjit = { path = "evmjit", optional = true }
ethash = { path = "ethash" } ethash = { path = "ethash" }
num_cpus = "0.2" num_cpus = "0.2"
clippy = "0.0.37" clippy = "0.0.37"

View File

@ -1,6 +1,5 @@
#![feature(plugin)] #![feature(plugin)]
#![plugin(docopt_macros)] #![plugin(docopt_macros)]
// required for serde, move it to a separate library
extern crate docopt; extern crate docopt;
extern crate rustc_serialize; extern crate rustc_serialize;
extern crate ethcore_util as util; extern crate ethcore_util as util;

View File

@ -15,4 +15,5 @@ jsonrpc-core = "1.1"
jsonrpc-http-server = "1.1" jsonrpc-http-server = "1.1"
ethcore-util = { path = "../util" } ethcore-util = { path = "../util" }
ethcore = { path = ".." } ethcore = { path = ".." }
clippy = "0.0.37"

View File

@ -1,3 +1,4 @@
//! Eth rpc implementation.
use std::sync::Arc; use std::sync::Arc;
use jsonrpc_core::*; use jsonrpc_core::*;
use util::hash::*; use util::hash::*;
@ -8,11 +9,13 @@ use ethcore::views::*;
use traits::{Eth, EthFilter}; use traits::{Eth, EthFilter};
use types::Block; use types::Block;
/// Eth rpc implementation.
pub struct EthClient { pub struct EthClient {
client: Arc<Client>, client: Arc<Client>,
} }
impl EthClient { impl EthClient {
/// Creates new EthClient.
pub fn new(client: Arc<Client>) -> Self { pub fn new(client: Arc<Client>) -> Self {
EthClient { EthClient {
client: client client: client
@ -100,11 +103,13 @@ impl Eth for EthClient {
} }
} }
/// Eth filter rpc implementation.
pub struct EthFilterClient { pub struct EthFilterClient {
client: Arc<Client> client: Arc<Client>
} }
impl EthFilterClient { impl EthFilterClient {
/// Creates new Eth filter client.
pub fn new(client: Arc<Client>) -> Self { pub fn new(client: Arc<Client>) -> Self {
EthFilterClient { EthFilterClient {
client: client client: client

View File

@ -2,9 +2,11 @@
use jsonrpc_core::*; use jsonrpc_core::*;
use traits::Net; use traits::Net;
/// Net rpc implementation.
pub struct NetClient; pub struct NetClient;
impl NetClient { impl NetClient {
/// Creates new NetClient.
pub fn new() -> Self { NetClient } pub fn new() -> Self { NetClient }
} }

View File

@ -1,9 +1,12 @@
//! Web3 rpc implementation.
use jsonrpc_core::*; use jsonrpc_core::*;
use traits::Web3; use traits::Web3;
/// Web3 rpc implementation.
pub struct Web3Client; pub struct Web3Client;
impl Web3Client { impl Web3Client {
/// Creates new Web3Client.
pub fn new() -> Self { Web3Client } pub fn new() -> Self { Web3Client }
} }

View File

@ -1,6 +1,8 @@
//! Ethcore rpc.
#![warn(missing_docs)]
#![feature(custom_derive, custom_attribute, plugin)] #![feature(custom_derive, custom_attribute, plugin)]
#![feature(slice_patterns)]
#![plugin(serde_macros)] #![plugin(serde_macros)]
#![plugin(clippy)]
extern crate serde; extern crate serde;
extern crate serde_json; extern crate serde_json;
@ -22,12 +24,14 @@ mod types;
pub use self::traits::{Web3, Eth, EthFilter, Net}; pub use self::traits::{Web3, Eth, EthFilter, Net};
pub use self::impls::*; pub use self::impls::*;
/// Http server.
pub struct HttpServer { pub struct HttpServer {
handler: IoHandler, handler: IoHandler,
threads: usize threads: usize
} }
impl HttpServer { impl HttpServer {
/// Construct new http server object with given number of threads.
pub fn new(threads: usize) -> HttpServer { pub fn new(threads: usize) -> HttpServer {
HttpServer { HttpServer {
handler: IoHandler::new(), 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 { pub fn add_delegate<D>(&mut self, delegate: IoDelegate<D>) where D: Send + Sync + 'static {
self.handler.add_delegate(delegate); self.handler.add_delegate(delegate);
} }
/// Start server asynchronously in new thread
pub fn start_async(self, addr: &str) { pub fn start_async(self, addr: &str) {
let server = jsonrpc_http_server::Server::new(self.handler, self.threads); let server = jsonrpc_http_server::Server::new(self.handler, self.threads);
server.start_async(addr) server.start_async(addr)

View File

@ -44,6 +44,7 @@ pub trait Eth: Sized + Send + Sync + 'static {
} }
} }
/// Eth filters rpc api (polling).
// TODO: do filters api properly // TODO: do filters api properly
pub trait EthFilter: Sized + Send + Sync + 'static { pub trait EthFilter: Sized + Send + Sync + 'static {
/// Returns id of new block filter /// Returns id of new block filter

View File

@ -26,7 +26,7 @@ crossbeam = "0.2"
slab = { git = "https://github.com/arkpar/slab.git" } slab = { git = "https://github.com/arkpar/slab.git" }
sha3 = { path = "sha3" } sha3 = { path = "sha3" }
serde = "0.6.7" serde = "0.6.7"
clippy = "*" # Always newest, since we use nightly clippy = "0.0.37"
[dev-dependencies] [dev-dependencies]
json-tests = { path = "json-tests" } json-tests = { path = "json-tests" }