Merge pull request #2460 from ethcore/ipc-codegen
Merge IPC codegen attributes into one
This commit is contained in:
commit
1782b659d1
@ -62,7 +62,7 @@ default = ["ui", "use-precompiled-js", "ipc"]
|
||||
ui = ["dapps", "ethcore-signer/ui"]
|
||||
use-precompiled-js = ["ethcore-dapps/use-precompiled-js", "ethcore-signer/use-precompiled-js"]
|
||||
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"]
|
||||
|
@ -157,7 +157,7 @@ impl Drop for Database {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Ipc)]
|
||||
#[ipc]
|
||||
impl DatabaseService for Database {
|
||||
fn open(&self, config: DatabaseConfig, path: String) -> Result<(), Error> {
|
||||
let mut db = self.db.write();
|
||||
|
@ -18,7 +18,7 @@ use ipc::IpcConfig;
|
||||
use util::H256;
|
||||
|
||||
/// Represents what has to be handled by actor listening to chain events
|
||||
#[derive(Ipc)]
|
||||
#[ipc]
|
||||
pub trait ChainNotify : Send + Sync {
|
||||
/// fires when chain has new blocks.
|
||||
fn new_blocks(&self,
|
||||
|
@ -38,7 +38,6 @@ use ipc::IpcConfig;
|
||||
use types::blockchain_info::BlockChainInfo;
|
||||
use types::block_status::BlockStatus;
|
||||
|
||||
#[derive(Ipc)]
|
||||
#[ipc(client_ident="RemoteClient")]
|
||||
/// Blockchain database client. Owns and manages a blockchain and a block queue.
|
||||
pub trait BlockChainClient : Sync + Send {
|
||||
|
@ -22,7 +22,6 @@ use ipc::IpcConfig;
|
||||
/// This handles:
|
||||
/// - restoration of snapshots to temporary databases.
|
||||
/// - responding to queries for snapshot manifests and chunks
|
||||
#[derive(Ipc)]
|
||||
#[ipc(client_ident="RemoteSnapshotService")]
|
||||
pub trait SnapshotService : Sync + Send {
|
||||
/// Query the most recent manifest data.
|
||||
|
@ -49,7 +49,7 @@ pub fn expand_ipc_implementation(
|
||||
let item = match *annotatable {
|
||||
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 implementations and traits");
|
||||
return;
|
||||
},
|
||||
};
|
||||
@ -832,7 +832,7 @@ fn implement_interface(
|
||||
_ => {
|
||||
cx.span_err(
|
||||
item.span,
|
||||
"`#[derive(Ipc)]` may only be applied to implementations and traits");
|
||||
"`#[ipc]` may only be applied to implementations and traits");
|
||||
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_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_post_expansion_pass(strip_attributes);
|
||||
@ -92,7 +92,7 @@ pub fn register(reg: &mut syntex::Registry) {
|
||||
#[cfg(not(feature = "with-syntex"))]
|
||||
pub fn register(reg: &mut rustc_plugin::Registry) {
|
||||
reg.register_syntax_extension(
|
||||
syntax::parse::token::intern("derive_Ipc"),
|
||||
syntax::parse::token::intern("ipc"),
|
||||
syntax::ext::base::MultiDecorator(
|
||||
Box::new(codegen::expand_ipc_implementation)));
|
||||
reg.register_syntax_extension(
|
||||
|
@ -40,12 +40,12 @@ pub struct ModuleState {
|
||||
}
|
||||
|
||||
|
||||
#[derive(Ipc)]
|
||||
#[ipc]
|
||||
pub trait ControlService {
|
||||
fn shutdown(&self) -> bool;
|
||||
}
|
||||
|
||||
#[derive(Ipc)]
|
||||
#[ipc]
|
||||
impl HypervisorService {
|
||||
// return type for making method synchronous
|
||||
fn module_ready(&self, module_id: u64, control_url: String) -> bool {
|
||||
|
@ -33,7 +33,7 @@ impl IpcConfig for DBWriter {}
|
||||
#[derive(Binary)]
|
||||
pub enum DBError { Write, Read }
|
||||
|
||||
#[derive(Ipc)]
|
||||
#[ipc]
|
||||
impl<L: Sized> DBWriter for DB<L> {
|
||||
fn write(&self, data: Vec<u8>) -> Result<(), DBError> {
|
||||
let mut writes = self.writes.write().unwrap();
|
||||
@ -48,7 +48,7 @@ impl<L: Sized> DBWriter for DB<L> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Ipc)]
|
||||
#[ipc]
|
||||
trait DBNotify {
|
||||
fn notify(&self, a: u64, b: u64) -> bool;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ pub struct CustomData {
|
||||
pub b: u64,
|
||||
}
|
||||
|
||||
#[derive(Ipc)]
|
||||
#[ipc]
|
||||
impl Service {
|
||||
fn commit(&self, f: u32) -> u32 {
|
||||
let mut lock = self.commits.write().unwrap();
|
||||
|
@ -18,7 +18,6 @@ use ipc::IpcConfig;
|
||||
|
||||
pub struct BadlyNamedService;
|
||||
|
||||
#[derive(Ipc)]
|
||||
#[ipc(client_ident="PrettyNamedClient")]
|
||||
impl BadlyNamedService {
|
||||
fn is_zero(&self, x: u64) -> bool {
|
||||
|
@ -32,7 +32,6 @@ impl From<std::io::Error> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Ipc)]
|
||||
#[ipc(client_ident="RemoteJobDispatcher")]
|
||||
/// Interface that can provide pow/blockchain-specific responses for the clients
|
||||
pub trait JobDispatcher: Send + Sync {
|
||||
@ -44,7 +43,6 @@ pub trait JobDispatcher: Send + Sync {
|
||||
fn job(&self, _worker_id: String) -> Option<String> { None }
|
||||
}
|
||||
|
||||
#[derive(Ipc)]
|
||||
#[ipc(client_ident="RemoteWorkHandler")]
|
||||
/// Interface that can handle requests to push job for workers
|
||||
pub trait PushWorkHandler: Send + Sync {
|
||||
|
@ -29,5 +29,6 @@ ethcore-ipc-nano = { path = "../ipc/nano" }
|
||||
parking_lot = "0.2.6"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
default = ["ipc"]
|
||||
dev = ["clippy", "ethcore/dev", "ethcore-util/dev"]
|
||||
ipc = []
|
||||
|
@ -88,7 +88,6 @@ impl EthSync {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Ipc)]
|
||||
#[ipc(client_ident="SyncClient")]
|
||||
impl SyncProvider for EthSync {
|
||||
/// Get sync status
|
||||
@ -184,7 +183,6 @@ pub trait ManageNetwork : Send + Sync {
|
||||
}
|
||||
|
||||
|
||||
#[derive(Ipc)]
|
||||
#[ipc(client_ident="NetworkManagerClient")]
|
||||
impl ManageNetwork for EthSync {
|
||||
fn accept_unreserved_peers(&self) {
|
||||
|
Loading…
Reference in New Issue
Block a user