derive -> ipc
This commit is contained in:
parent
6e477951ba
commit
2b147616fd
16
Cargo.lock
generated
16
Cargo.lock
generated
@ -276,7 +276,6 @@ dependencies = [
|
|||||||
"bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bloomchain 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bloomchain 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"clippy 0.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"crossbeam 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"crossbeam 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethash 1.4.0",
|
"ethash 1.4.0",
|
||||||
@ -290,7 +289,6 @@ dependencies = [
|
|||||||
"ethjson 0.1.0",
|
"ethjson 0.1.0",
|
||||||
"ethkey 0.2.0",
|
"ethkey 0.2.0",
|
||||||
"ethstore 0.1.0",
|
"ethstore 0.1.0",
|
||||||
"evmjit 1.4.0",
|
|
||||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hyper 0.9.4 (git+https://github.com/ethcore/hyper)",
|
"hyper 0.9.4 (git+https://github.com/ethcore/hyper)",
|
||||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -324,7 +322,6 @@ version = "0.1.0"
|
|||||||
name = "ethcore-dapps"
|
name = "ethcore-dapps"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"ethabi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ethabi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore-devtools 1.4.0",
|
"ethcore-devtools 1.4.0",
|
||||||
"ethcore-rpc 1.4.0",
|
"ethcore-rpc 1.4.0",
|
||||||
@ -466,7 +463,6 @@ dependencies = [
|
|||||||
name = "ethcore-rpc"
|
name = "ethcore-rpc"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"ethash 1.4.0",
|
"ethash 1.4.0",
|
||||||
"ethcore 1.4.0",
|
"ethcore 1.4.0",
|
||||||
"ethcore-devtools 1.4.0",
|
"ethcore-devtools 1.4.0",
|
||||||
@ -496,7 +492,6 @@ dependencies = [
|
|||||||
name = "ethcore-signer"
|
name = "ethcore-signer"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore-devtools 1.4.0",
|
"ethcore-devtools 1.4.0",
|
||||||
"ethcore-io 1.4.0",
|
"ethcore-io 1.4.0",
|
||||||
@ -534,7 +529,6 @@ version = "1.4.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ansi_term 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"arrayvec 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"clippy 0.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"elastic-array 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"elastic-array 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"eth-secp256k1 0.5.4 (git+https://github.com/ethcore/rust-secp256k1)",
|
"eth-secp256k1 0.5.4 (git+https://github.com/ethcore/rust-secp256k1)",
|
||||||
@ -588,7 +582,6 @@ dependencies = [
|
|||||||
name = "ethkey"
|
name = "ethkey"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"eth-secp256k1 0.5.4 (git+https://github.com/ethcore/rust-secp256k1)",
|
"eth-secp256k1 0.5.4 (git+https://github.com/ethcore/rust-secp256k1)",
|
||||||
"ethcore-bigint 0.1.0",
|
"ethcore-bigint 0.1.0",
|
||||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -601,7 +594,6 @@ dependencies = [
|
|||||||
name = "ethstore"
|
name = "ethstore"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"ethcrypto 0.1.0",
|
"ethcrypto 0.1.0",
|
||||||
"ethkey 0.2.0",
|
"ethkey 0.2.0",
|
||||||
"itertools 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"itertools 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -621,7 +613,6 @@ dependencies = [
|
|||||||
name = "ethsync"
|
name = "ethsync"
|
||||||
version = "1.4.0"
|
version = "1.4.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clippy 0.0.90 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"env_logger 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ethcore 1.4.0",
|
"ethcore 1.4.0",
|
||||||
"ethcore-io 1.4.0",
|
"ethcore-io 1.4.0",
|
||||||
@ -639,13 +630,6 @@ dependencies = [
|
|||||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "evmjit"
|
|
||||||
version = "1.4.0"
|
|
||||||
dependencies = [
|
|
||||||
"tiny-keccak 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fdlimit"
|
name = "fdlimit"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -62,14 +62,7 @@ default = ["ui", "use-precompiled-js", "ipc"]
|
|||||||
ui = ["dapps", "ethcore-signer/ui"]
|
ui = ["dapps", "ethcore-signer/ui"]
|
||||||
use-precompiled-js = ["ethcore-dapps/use-precompiled-js", "ethcore-signer/use-precompiled-js"]
|
use-precompiled-js = ["ethcore-dapps/use-precompiled-js", "ethcore-signer/use-precompiled-js"]
|
||||||
dapps = ["ethcore-dapps"]
|
dapps = ["ethcore-dapps"]
|
||||||
ipc = ["ethcore/ipc"]
|
ipc = ["ethcore/ipc", "ethsync/ipc"]
|
||||||
jit = ["ethcore/jit"]
|
|
||||||
dev = ["clippy", "ethcore/dev", "ethcore-util/dev", "ethsync/dev", "ethcore-rpc/dev", "ethcore-dapps/dev", "ethcore-signer/dev"]
|
|
||||||
json-tests = ["ethcore/json-tests"]
|
|
||||||
stratum = ["ipc"]
|
|
||||||
ethkey-cli = ["ethcore/ethkey-cli"]
|
|
||||||
ethstore-cli = ["ethcore/ethstore-cli"]
|
|
||||||
evm-debug = ["ethcore/evm-debug"]
|
|
||||||
evm-debug-tests = ["ethcore/evm-debug-tests"]
|
evm-debug-tests = ["ethcore/evm-debug-tests"]
|
||||||
slow-blocks = ["ethcore/slow-blocks"]
|
slow-blocks = ["ethcore/slow-blocks"]
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ impl Drop for Database {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Ipc)]
|
#[ipc]
|
||||||
impl DatabaseService for Database {
|
impl DatabaseService for Database {
|
||||||
fn open(&self, config: DatabaseConfig, path: String) -> Result<(), Error> {
|
fn open(&self, config: DatabaseConfig, path: String) -> Result<(), Error> {
|
||||||
let mut db = self.db.write();
|
let mut db = self.db.write();
|
||||||
|
@ -18,7 +18,7 @@ use ipc::IpcConfig;
|
|||||||
use util::H256;
|
use util::H256;
|
||||||
|
|
||||||
/// Represents what has to be handled by actor listening to chain events
|
/// Represents what has to be handled by actor listening to chain events
|
||||||
#[derive(Ipc)]
|
#[ipc]
|
||||||
pub trait ChainNotify : Send + Sync {
|
pub trait ChainNotify : Send + Sync {
|
||||||
/// fires when chain has new blocks.
|
/// fires when chain has new blocks.
|
||||||
fn new_blocks(&self,
|
fn new_blocks(&self,
|
||||||
|
@ -38,7 +38,6 @@ use ipc::IpcConfig;
|
|||||||
use types::blockchain_info::BlockChainInfo;
|
use types::blockchain_info::BlockChainInfo;
|
||||||
use types::block_status::BlockStatus;
|
use types::block_status::BlockStatus;
|
||||||
|
|
||||||
#[derive(Ipc)]
|
|
||||||
#[ipc(client_ident="RemoteClient")]
|
#[ipc(client_ident="RemoteClient")]
|
||||||
/// Blockchain database client. Owns and manages a blockchain and a block queue.
|
/// Blockchain database client. Owns and manages a blockchain and a block queue.
|
||||||
pub trait BlockChainClient : Sync + Send {
|
pub trait BlockChainClient : Sync + Send {
|
||||||
|
@ -22,7 +22,6 @@ use ipc::IpcConfig;
|
|||||||
/// This handles:
|
/// This handles:
|
||||||
/// - restoration of snapshots to temporary databases.
|
/// - restoration of snapshots to temporary databases.
|
||||||
/// - responding to queries for snapshot manifests and chunks
|
/// - responding to queries for snapshot manifests and chunks
|
||||||
#[derive(Ipc)]
|
|
||||||
#[ipc(client_ident="RemoteSnapshotService")]
|
#[ipc(client_ident="RemoteSnapshotService")]
|
||||||
pub trait SnapshotService : Sync + Send {
|
pub trait SnapshotService : Sync + Send {
|
||||||
/// Query the most recent manifest data.
|
/// Query the most recent manifest data.
|
||||||
|
@ -49,7 +49,7 @@ pub fn expand_ipc_implementation(
|
|||||||
let item = match *annotatable {
|
let item = match *annotatable {
|
||||||
Annotatable::Item(ref item) => item,
|
Annotatable::Item(ref item) => item,
|
||||||
_ => {
|
_ => {
|
||||||
cx.span_err(meta_item.span, "`#[derive(Ipc)]` may only be applied to struct implementations");
|
cx.span_err(meta_item.span, "`#[ipc]` may only be applied to struct implementations");
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -832,7 +832,7 @@ fn implement_interface(
|
|||||||
_ => {
|
_ => {
|
||||||
cx.span_err(
|
cx.span_err(
|
||||||
item.span,
|
item.span,
|
||||||
"`#[derive(Ipc)]` may only be applied to implementations and traits");
|
"`#[ipc]` may only be applied to implementations and traits");
|
||||||
return Err(Error);
|
return Err(Error);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -83,7 +83,7 @@ pub fn register(reg: &mut syntex::Registry) {
|
|||||||
reg.add_attr("feature(custom_derive)");
|
reg.add_attr("feature(custom_derive)");
|
||||||
reg.add_attr("feature(custom_attribute)");
|
reg.add_attr("feature(custom_attribute)");
|
||||||
|
|
||||||
reg.add_decorator("derive_Ipc", codegen::expand_ipc_implementation);
|
reg.add_decorator("ipc", codegen::expand_ipc_implementation);
|
||||||
reg.add_decorator("derive_Binary", serialization::expand_serialization_implementation);
|
reg.add_decorator("derive_Binary", serialization::expand_serialization_implementation);
|
||||||
|
|
||||||
reg.add_post_expansion_pass(strip_attributes);
|
reg.add_post_expansion_pass(strip_attributes);
|
||||||
@ -92,7 +92,7 @@ pub fn register(reg: &mut syntex::Registry) {
|
|||||||
#[cfg(not(feature = "with-syntex"))]
|
#[cfg(not(feature = "with-syntex"))]
|
||||||
pub fn register(reg: &mut rustc_plugin::Registry) {
|
pub fn register(reg: &mut rustc_plugin::Registry) {
|
||||||
reg.register_syntax_extension(
|
reg.register_syntax_extension(
|
||||||
syntax::parse::token::intern("derive_Ipc"),
|
syntax::parse::token::intern("ipc"),
|
||||||
syntax::ext::base::MultiDecorator(
|
syntax::ext::base::MultiDecorator(
|
||||||
Box::new(codegen::expand_ipc_implementation)));
|
Box::new(codegen::expand_ipc_implementation)));
|
||||||
reg.register_syntax_extension(
|
reg.register_syntax_extension(
|
||||||
|
@ -40,12 +40,12 @@ pub struct ModuleState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Ipc)]
|
#[ipc]
|
||||||
pub trait ControlService {
|
pub trait ControlService {
|
||||||
fn shutdown(&self) -> bool;
|
fn shutdown(&self) -> bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Ipc)]
|
#[ipc]
|
||||||
impl HypervisorService {
|
impl HypervisorService {
|
||||||
// return type for making method synchronous
|
// return type for making method synchronous
|
||||||
fn module_ready(&self, module_id: u64, control_url: String) -> bool {
|
fn module_ready(&self, module_id: u64, control_url: String) -> bool {
|
||||||
|
@ -33,7 +33,7 @@ impl IpcConfig for DBWriter {}
|
|||||||
#[derive(Binary)]
|
#[derive(Binary)]
|
||||||
pub enum DBError { Write, Read }
|
pub enum DBError { Write, Read }
|
||||||
|
|
||||||
#[derive(Ipc)]
|
#[ipc]
|
||||||
impl<L: Sized> DBWriter for DB<L> {
|
impl<L: Sized> DBWriter for DB<L> {
|
||||||
fn write(&self, data: Vec<u8>) -> Result<(), DBError> {
|
fn write(&self, data: Vec<u8>) -> Result<(), DBError> {
|
||||||
let mut writes = self.writes.write().unwrap();
|
let mut writes = self.writes.write().unwrap();
|
||||||
@ -48,7 +48,7 @@ impl<L: Sized> DBWriter for DB<L> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Ipc)]
|
#[ipc]
|
||||||
trait DBNotify {
|
trait DBNotify {
|
||||||
fn notify(&self, a: u64, b: u64) -> bool;
|
fn notify(&self, a: u64, b: u64) -> bool;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ pub struct CustomData {
|
|||||||
pub b: u64,
|
pub b: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Ipc)]
|
#[ipc]
|
||||||
impl Service {
|
impl Service {
|
||||||
fn commit(&self, f: u32) -> u32 {
|
fn commit(&self, f: u32) -> u32 {
|
||||||
let mut lock = self.commits.write().unwrap();
|
let mut lock = self.commits.write().unwrap();
|
||||||
|
@ -18,7 +18,6 @@ use ipc::IpcConfig;
|
|||||||
|
|
||||||
pub struct BadlyNamedService;
|
pub struct BadlyNamedService;
|
||||||
|
|
||||||
#[derive(Ipc)]
|
|
||||||
#[ipc(client_ident="PrettyNamedClient")]
|
#[ipc(client_ident="PrettyNamedClient")]
|
||||||
impl BadlyNamedService {
|
impl BadlyNamedService {
|
||||||
fn is_zero(&self, x: u64) -> bool {
|
fn is_zero(&self, x: u64) -> bool {
|
||||||
|
@ -32,7 +32,6 @@ impl From<std::io::Error> for Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Ipc)]
|
|
||||||
#[ipc(client_ident="RemoteJobDispatcher")]
|
#[ipc(client_ident="RemoteJobDispatcher")]
|
||||||
/// Interface that can provide pow/blockchain-specific responses for the clients
|
/// Interface that can provide pow/blockchain-specific responses for the clients
|
||||||
pub trait JobDispatcher: Send + Sync {
|
pub trait JobDispatcher: Send + Sync {
|
||||||
@ -44,7 +43,6 @@ pub trait JobDispatcher: Send + Sync {
|
|||||||
fn job(&self, _worker_id: String) -> Option<String> { None }
|
fn job(&self, _worker_id: String) -> Option<String> { None }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Ipc)]
|
|
||||||
#[ipc(client_ident="RemoteWorkHandler")]
|
#[ipc(client_ident="RemoteWorkHandler")]
|
||||||
/// Interface that can handle requests to push job for workers
|
/// Interface that can handle requests to push job for workers
|
||||||
pub trait PushWorkHandler: Send + Sync {
|
pub trait PushWorkHandler: Send + Sync {
|
||||||
|
@ -29,5 +29,6 @@ ethcore-ipc-nano = { path = "../ipc/nano" }
|
|||||||
parking_lot = "0.2.6"
|
parking_lot = "0.2.6"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = ["ipc"]
|
||||||
dev = ["clippy", "ethcore/dev", "ethcore-util/dev"]
|
dev = ["clippy", "ethcore/dev", "ethcore-util/dev"]
|
||||||
|
ipc = []
|
||||||
|
@ -88,7 +88,6 @@ impl EthSync {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Ipc)]
|
|
||||||
#[ipc(client_ident="SyncClient")]
|
#[ipc(client_ident="SyncClient")]
|
||||||
impl SyncProvider for EthSync {
|
impl SyncProvider for EthSync {
|
||||||
/// Get sync status
|
/// Get sync status
|
||||||
@ -184,7 +183,6 @@ pub trait ManageNetwork : Send + Sync {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Ipc)]
|
|
||||||
#[ipc(client_ident="NetworkManagerClient")]
|
#[ipc(client_ident="NetworkManagerClient")]
|
||||||
impl ManageNetwork for EthSync {
|
impl ManageNetwork for EthSync {
|
||||||
fn accept_unreserved_peers(&self) {
|
fn accept_unreserved_peers(&self) {
|
||||||
|
Loading…
Reference in New Issue
Block a user