|
1 | 1 | # libmultiprocess |
2 | 2 |
|
3 | | -## Summary |
| 3 | +`libmultiprocess` is a C++ library and code generator making it easy to call functions and reference objects in different processes. |
4 | 4 |
|
5 | | -C++ library and code generator making it easy to call functions and reference objects in different processes. |
| 5 | +For more information see the [usage instructions](doc/usage.md), [installation instructions](doc/install.md), or [design documentation](doc/design.md). |
6 | 6 |
|
7 | | -## Description |
8 | | - |
9 | | -Given an interface description of an object with one or more methods, libmultiprocess generates: |
10 | | - |
11 | | -* A C++ `ProxyClient` class with an implementation of each interface method that sends a request over a socket, waits for a response, and returns the result. |
12 | | -* A C++ `ProxyServer` class that listens for requests over a socket and calls a wrapped C++ object implementating the same interface to actually execute the requests. |
13 | | - |
14 | | -The function call ⇆ request translation supports input and output arguments, standard types like `unique_ptr`, `vector`, `map`, and `optional`, and bidirectional calls between processes through interface pointer and `std::function` arguments. |
15 | | - |
16 | | -If the wrapped C++ object inherits from an abstract base class declaring virtual methods, the generated `ProxyClient` objects can inherit from the same class, allowing interprocess calls to replace local calls without changes to existing code. |
17 | | - |
18 | | -There is also optional support for thread mapping, so each thread making interprocess calls can have a dedicated thread processing requests from it, and callbacks from processing threads are executed on corresponding request threads (so recursive mutexes and thread names function as expected in callbacks). |
19 | | - |
20 | | -### What is `kj`? |
21 | | - |
22 | | -KJ is a concurrency framework [bundled with |
23 | | -capnproto](https://capnproto.org/cxxrpc.html#kj-concurrency-framework); it is used as a |
24 | | -basis in this library to construct the event-loop necessary to service IPC requests. |
25 | | - |
26 | | -## Example |
27 | | - |
28 | | -A simple interface description can be found at [test/mp/test/foo.capnp](test/mp/test/foo.capnp), implementation in [test/mp/test/foo.h](test/mp/test/foo.h), and usage in [test/mp/test/test.cpp](test/mp/test/test.cpp). |
29 | | - |
30 | | -A more complete example can be found in [example](example/) and run with: |
31 | | - |
32 | | -```sh |
33 | | -make -C build example |
34 | | -build/example/mpexample |
35 | | -``` |
36 | | - |
37 | | -## Future directions |
38 | | - |
39 | | -_libmultiprocess_ uses the [Cap'n Proto](https://capnproto.org) interface description language and protocol, but it could be extended or changed to use a different IDL/protocol like [gRPC](https://grpc.io). The nice thing about _Cap'n Proto_ compared to _gRPC_ and most other lower level protocols is that it allows interface pointers (_Services_ in gRPC parlance) to be passed as method arguments and return values, so object references and bidirectional requests work out of the box. Supporting a lower-level protocol would require writing adding maps and tracking code to proxy objects. |
40 | | - |
41 | | -_libmultiprocess_ is currently compatible with sandboxing but could add platform-specific sandboxing support or integration with a sandboxing library like [SAPI](https://github.com/google/sandboxed-api). |
42 | | - |
43 | | -## Installation |
44 | | - |
45 | | -Installation currently requires Cap'n Proto: |
46 | | - |
47 | | -```sh |
48 | | -apt install libcapnp-dev capnproto |
49 | | -brew install capnp |
50 | | -dnf install capnproto |
51 | | -``` |
52 | | - |
53 | | -Installation steps are: |
54 | | - |
55 | | -```sh |
56 | | -mkdir build |
57 | | -cd build |
58 | | -cmake .. |
59 | | -make |
60 | | -make check # Optionally build and run tests |
61 | | -make install |
62 | | -``` |
| 7 | +If you have any questions, comments, or feedback, please submit an [issue](https://github.com/chaincodelabs/libmultiprocess/issues/new). |
| 8 | +Duplicate issues are perfectly fine and all discussion about the project is welcome, since there isn't another discussion forum currently. |
0 commit comments