1 # Copyright (c) The Bitcoin Core developers
2 # Distributed under the MIT software license, see the accompanying
3 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 5 @0xcc316e3f71a040fb;
6 7 using Cxx = import "/capnp/c++.capnp";
8 $Cxx.namespace("mp");
9 10 annotation include(file): Text;
11 annotation includeTypes(file): Text;
12 # Extra include paths to add to generated files.
13 14 annotation wrap(interface, struct): Text;
15 # Wrap capnp interface generating ProxyClient / ProxyServer C++ classes that
16 # forward calls to a C++ interface with same methods and parameters. Text
17 # string should be the name of the C++ interface.
18 # If applied to struct rather than an interface, this will generate a ProxyType
19 # struct with get methods for introspection and copying fields between C++ and
20 # capnp structs.
21 22 annotation count(param, struct, interface): Int32;
23 # Indicate how many C++ method parameters there are corresponding to one capnp
24 # parameter (default is 1). If not 1, multiple C++ method arguments will be
25 # condensed into a single capnp parameter by the client and then expanded by
26 # the server by CustomReadField/CustomBuildField overloads which need to be
27 # provided separately. An example would be a capnp Text parameter initialized
28 # from C++ char* and size arguments. Can be 0 to fill an implicit capnp
29 # parameter from client or server side context. If annotation is applied to an
30 # interface or struct type it will apply to all parameters of that type.
31 32 annotation exception(param): Text;
33 # Indicate that a result parameter corresponds to a C++ exception. Text string
34 # should be the name of a C++ exception type that the generated server class
35 # will catch and the client class will rethrow.
36 37 annotation name(field, method): Text;
38 # Name of the C++ method or field corresponding to a capnp method or field.
39 40 annotation skip(field): Void;
41 # Synonym for count(0).
42 43 interface ThreadMap $count(0) {
44 # Interface letting clients control which thread a method call should
45 # execute on. Clients create and name threads and pass the thread handle as
46 # a call parameter.
47 makeThread @0 (name :Text) -> (result :Thread);
48 # Pre-allocate a pool of server threads for implicit dispatch. When a
49 # request arrives with no context.thread set, the server dispatches it
50 # through this pool via a shared work queue.
51 makePool @1 (count :UInt32) -> ();
52 }
53 54 interface Thread {
55 # Thread handle returned by makeThread corresponding to one server thread.
56 57 getName @0 () -> (result: Text);
58 }
59 60 struct Context $count(0) {
61 # Execution context passed as a parameter from the client class to the server class.
62 63 thread @0 : Thread;
64 # Handle of the server thread the current method call should execute on.
65 66 callbackThread @1 : Thread;
67 # Handle of the client thread that is calling the current method, and that
68 # any callbacks made by the server thread should be made on.
69 }
70