| Action Engine
             | 
A Python subclass of WireStream that allows for custom implementations of the stream methods in Python.
This class is intended to be used as a base class for Python implementations of WireStream. It provides default implementations that call the corresponding Python methods, allowing for easy customization. This is a so-called trampoline class in the sense implied by PyBind11.
Action Engine uses pybind11_abseil's Status bindings, so any absl::Status returned is automatically converted to a Python exception. If the Python method returns a coroutine, the best effort is made to run it in a threadsafe manner, using pybindings::RunThreadsafeIfCoroutine. However, this is not guaranteed to work in all cases, so it is recommended to take extra care when implementing the methods in Python and be aware of potential issues with coroutines. 
#include <service_pybind11.h>
| Public Member Functions | |
| absl::Status | Send (WireMessage message) override | 
| absl::StatusOr< std::optional< WireMessage > > | Receive (absl::Duration timeout) override | 
| absl::Status | Accept () override | 
| absl::Status | Start () override | 
| void | HalfClose () override | 
| void | Abort () override | 
| absl::Status | GetStatus () const override | 
| std::string | GetId () const override | 
|  Public Member Functions inherited from act::WireStream | |
| virtual auto | GetImpl () const -> const void * | 
| template<typename T> | |
| auto | GetImpl () const -> T * | 
| 
 | inlineoverridevirtual | 
Aborts the stream.
This is used to terminate the stream immediately with an "error" state. For example, the result of Receive() following an Abort() call by either side should be an error status, indicating that the stream is no longer usable, and not an empty optional.
Implements act::WireStream.
| 
 | inlineoverridevirtual | 
Accepts the stream on the server side.
Clients should not call this method. It is intended to be called by the server to accept a stream that has been initiated by a client. Implementations that differentiate between client and server streams are allowed to return an error if this method is called on a client, or even to perform a hard termination of the process, as such a call is considered a misuse of the API.
Some implementations may not require this method, in which case they can return an OK status without doing anything.
Implements act::WireStream.
| 
 | inlinenodiscardoverridevirtual | 
Returns the unique (in this process) identifier of the stream.
Implements act::WireStream.
| 
 | inlineoverridevirtual | 
Returns the status of the stream.
This method is used to check the current status of the stream, which is OK unless the stream has been aborted.
absl::Status indicating the current status of the stream. If the stream is in a valid state, it returns absl::OkStatus(). If the stream is in an error state (e.g., due to an abort), it returns an appropriate error status. Implements act::WireStream.
| 
 | inlineoverridevirtual | 
Communicates to the other end that no more messages will be sent over this stream.
Implements act::WireStream.
| 
 | inlineoverridevirtual | 
Receives an ActionEngine wire message from the stream.
Blocks to wait for a message to be received, up to the specified timeout.
| timeout | The maximum duration to wait for a message to be received. If the timeout is reached, the function will return an absl::DeadlineExceededError. | 
Receive() is called in a loop, and the loop should be able to terminate gracefully when the stream is aborted. Implements act::WireStream.
| 
 | inlineoverridevirtual | 
Sends a WireMessage over the stream.
May or may not block, depending on the implementation. For example, WebsocketWireStream will block until the message is sent, while WebRtcWireStream will return immediately, allowing the message to be sent asynchronously.
With that in mind, the caller should not assume that the message has been sent immediately after this function returns, or even that it has been sent successfully. Failure modes of this method are more about the invariants of the stream itself: for example, if the stream is closed, or half-closed (no more messages can be sent), this method will return an error.
| message | The WireMessage to send, containing action calls (in the form of multiple ActionMessage) and/or node fragments. | 
Implements act::WireStream.
| 
 | inlineoverridevirtual | 
Starts the stream on the client side.
Clients should call this method to initiate the stream after it has been created. This method is intended to be called by the client to start the stream, which may involve some underlying negotiation or setup. Implementations that differentiate between client and server streams are allowed to return an error if this method is called on a server, or even to perform a hard termination of the process, as such a call is considered a misuse of the API.
Some implementations may not require this method, in which case they can return an OK status without doing anything.
Implements act::WireStream.