aboutsummaryrefslogtreecommitdiff
path: root/src/ipc
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2020-11-24 13:59:33 -0500
committerRussell Yanofsky <russ@yanofsky.org>2021-04-23 03:02:50 -0500
commit84934bf70e11fe4cda1cfda60113a54895d4fdd5 (patch)
treea76e8bd27d3e32a9f433d6f24857d6b96e499efc /src/ipc
parent7d76cf667eff512043a28d4407cc89f58796c42b (diff)
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.
Diffstat (limited to 'src/ipc')
-rw-r--r--src/ipc/capnp/echo.capnp17
-rw-r--r--src/ipc/capnp/init-types.h3
-rw-r--r--src/ipc/capnp/init.capnp4
3 files changed, 24 insertions, 0 deletions
diff --git a/src/ipc/capnp/echo.capnp b/src/ipc/capnp/echo.capnp
new file mode 100644
index 0000000000..df36ee0de3
--- /dev/null
+++ b/src/ipc/capnp/echo.capnp
@@ -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);
+}
diff --git a/src/ipc/capnp/init-types.h b/src/ipc/capnp/init-types.h
index c84b94802a..42031441b5 100644
--- a/src/ipc/capnp/init-types.h
+++ b/src/ipc/capnp/init-types.h
@@ -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
diff --git a/src/ipc/capnp/init.capnp b/src/ipc/capnp/init.capnp
index be6eecb4b9..e6d358c665 100644
--- a/src/ipc/capnp/init.capnp
+++ b/src/ipc/capnp/init.capnp
@@ -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);
}