mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-05 03:18:50 +02:00
multiprocess: Add echoipc RPC method and test
Add simple interfaces::Echo IPC interface with one method that just takes and returns a string, to test multiprocess framework and provide an example of how it can be used to spawn and call between processes.
This commit is contained in:
17
src/ipc/capnp/echo.capnp
Normal file
17
src/ipc/capnp/echo.capnp
Normal file
@@ -0,0 +1,17 @@
|
||||
# Copyright (c) 2021 The Bitcoin Core developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
@0x888b4f7f51e691f7;
|
||||
|
||||
using Cxx = import "/capnp/c++.capnp";
|
||||
$Cxx.namespace("ipc::capnp::messages");
|
||||
|
||||
using Proxy = import "/mp/proxy.capnp";
|
||||
$Proxy.include("interfaces/echo.h");
|
||||
$Proxy.include("ipc/capnp/echo.capnp.h");
|
||||
|
||||
interface Echo $Proxy.wrap("interfaces::Echo") {
|
||||
destroy @0 (context :Proxy.Context) -> ();
|
||||
echo @1 (context :Proxy.Context, echo: Text) -> (result :Text);
|
||||
}
|
||||
@@ -4,4 +4,7 @@
|
||||
|
||||
#ifndef BITCOIN_IPC_CAPNP_INIT_TYPES_H
|
||||
#define BITCOIN_IPC_CAPNP_INIT_TYPES_H
|
||||
|
||||
#include <ipc/capnp/echo.capnp.proxy-types.h>
|
||||
|
||||
#endif // BITCOIN_IPC_CAPNP_INIT_TYPES_H
|
||||
|
||||
@@ -8,9 +8,13 @@ using Cxx = import "/capnp/c++.capnp";
|
||||
$Cxx.namespace("ipc::capnp::messages");
|
||||
|
||||
using Proxy = import "/mp/proxy.capnp";
|
||||
$Proxy.include("interfaces/echo.h");
|
||||
$Proxy.include("interfaces/init.h");
|
||||
$Proxy.includeTypes("ipc/capnp/init-types.h");
|
||||
|
||||
using Echo = import "echo.capnp";
|
||||
|
||||
interface Init $Proxy.wrap("interfaces::Init") {
|
||||
construct @0 (threadMap: Proxy.ThreadMap) -> (threadMap :Proxy.ThreadMap);
|
||||
makeEcho @1 (context :Proxy.Context) -> (result :Echo.Echo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user