Commit Graph

12 Commits

Author SHA1 Message Date
Wyatt Hepler
01fc15be6a pw_rpc: Handle client streams in the server
- Handle client stream messages in the RPC server. Client streaming RPCs
  cannot yet be created.
- Add callbacks for errors, client stream messages, and client stream
  completion.
- Rename Responder's Finish to CloseAndSendStatus to avoid overlapping
  Reader/Writer implementations' Finish() methods.
- Move Nanopb ServerWrite::Write to the .cc file.

Change-Id: Ie4894e6b2fd47a6fc7efdfba58ebeaddff9002e0
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/50362
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
2021-07-02 06:19:29 +00:00
Wyatt Hepler
5ba80646bf pw_rpc: Update protocol for server streams
Update the server-to-client RPC packet types so that the packet type
unambiguously indicates whether it is the first or last packet. This is
already the case for client-to-server RPC packet types.

- Have RESPONSE always be the last packet in the stream. For RPCs
  without a server stream, it includes a payload. Remove
  SERVER_STREAM_END.
- Introduce the SERVER_STREAM packet, to parallel the CLIENT_STREAM
  packet.
- Update the server and client code and tests. Test that old-style
  streaming RPCs still work correctly.
- Refactor the duplicate MessageOutput class into a FakeChannelOutput
  used by both Nanopb and raw RPCs.
- In C++, don't encode default-valued payload and status fields.

Change-Id: I218772dad6c2981dda5f032f298ea43ee5e08b4d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/49822
Commit-Queue: Wyatt Hepler <hepler@google.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
2021-06-23 00:56:39 +00:00
Wyatt Hepler
74e7ab6e0e pw_rpc: Rename base_server_writer files
This file rename was done in a separate change from the class rename so
Git would detect these as file moves rather than new files.

Change-Id: I37b6168b142197628b6694736ce0fbe36e44b263
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/49201
Commit-Queue: Wyatt Hepler <hepler@google.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
2021-06-16 17:36:05 +00:00
Alexei Frolov
3e28092cd5 pw_rpc: Add ClientServer combination
This adds a class which wraps both an RPC client and server, simplifying
setup and usage in systems that require both.

Change-Id: I00e3cbeef91b8703c432800f58a96db5faff63f4
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/40624
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Alexei Frolov <frolv@google.com>
2021-04-14 00:17:06 +00:00
Wyatt Hepler
ba325e410e pw_rpc: Merge pw_rpc protos into the pw_rpc package
This merges the pw_rpc_protos pw_proto_library Python package into
pw_rpc.

Requires: pigweed-internal:10840
Change-Id: Ib510571d75281d29d2a6719950b33ec09d0a5b9d
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/36505
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Joe Ethier <jethier@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
2021-03-16 18:32:25 +00:00
Wyatt Hepler
752d7d3459 pw_protobuf_compiler: Decouple proto packaging from directory
- Allow specifying prefix and strip_prefix arguments for proto files.
  The proto directory tree is built as specified in the out directory.
- Only invoke protoc from the default toolchain. This prevents duplicate
  protoc invocations.
- Prevent duplicate pw_proto_library Python package definitions anywhere
  in the build.
- Replace implicit handling of standalone external protos with a
  python_package_as_module option.

Change-Id: Id37d8b4d83294f7d3142a389e74ceea96dd4d620
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/34640
Reviewed-by: Alexei Frolov <frolv@google.com>
2021-03-05 20:43:22 +00:00
Wyatt Hepler
9174147f71 pw_protobuf_compiler: Avoid duplicate protobuf Python packages
For compatibility with Python packaging, each pw_protobuf_library target
must have a unique root directory for its protos. If this is violated,
the setup.py for the Python package is generated multiple times,
resulting in flaky builds.

This change ensures that no two pw_proto_library targets generate the
same Python package and fixes existing conflicts in the Pigweed repo.

Change-Id: Icbc13ceeb2fd329bc4fbf1e14ec039e98dc7e483
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/31740
Reviewed-by: Alexei Frolov <frolv@google.com>
2021-02-03 19:36:05 +00:00
Alexei Frolov
e39af8d8da pw_rpc: Add synchronized channel output
This adds an channel output wrapper which synchronizes a ChannelOutput's
operations with a sync::Mutex, and updates the host target's system RPC server
to use it.

Change-Id: I3d2407a8c81a8f0370fd714ded850293d7030209
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/28540
Commit-Queue: Alexei Frolov <frolv@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Ewout van Bekkum <ewout@google.com>
2021-01-06 18:08:28 +00:00
Wyatt Hepler
7208cd9d90 pw_stream: Update CMake build
- Split the CMake build into separate libraries so that the socket
  stream code is not automatically built.
- Fix public/private deps in the GN build.
- Add pw_rpc/system_server/CMakeLists.txt.
- In the CMake presubmit step, install Nanopb and build CMake's pw_apps.

Change-Id: Id29673d5d26e30e1b196768b8667805ec3094e3e
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/27581
Reviewed-by: Armando Montanez <amontanez@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
2020-12-16 01:51:04 +00:00
Wyatt Hepler
c9e51d20b2 CMake: Support protobuf code gen; add pw_rpc
- Add proto.cmake and the pw_proto_library function. Like the GN
  version, this generates code for .proto files.
- Provide CMakeLists.txt for pw_protobuf, pw_rpc, and pw_hdlc_lite.
- Add a Nanopb wrapper CMakeLists.txt with a cache variable for Nanopb,
  similar to the variable for GN.

Change-Id: I15d09af8aa3575a86fc360787b117988a75f569e
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22841
Reviewed-by: Zoltan Szatmary-Ban <szatmz@google.com>
Reviewed-by: Alexei Frolov <frolv@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
2020-11-05 20:13:44 +00:00
Wyatt Hepler
0a6f763b12 CMake: Revamp CMake build
- Define CMake cache variables (similar to gn args) for facade backends.
- Create simple initial toolchain files for GCC and Clang.
- Misc updates to pigweed.cmake and pw_build/CMakeLists.txt.
- Add or expand various CMakeLists.txt files.
- Watch CMake files in watch.py to support using CMake in pw watch.

Change-Id: I490d157485d02811a11f6a3589a0508ea1851f58
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/22840
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Reviewed-by: Keir Mierle <keir@google.com>
2020-11-04 22:31:07 +00:00
Alexei Frolov
26e3ae6ed6 pw_rpc: Module boilerplate
This change creates the pw_rpc module with all of the standard Pigweed
module boilerplate.

Change-Id: Iac3951a81a0edd286a8b1c7e19c614a7b73c0d07
2020-05-08 01:51:46 +00:00