An accessor class for an ActionEngine action.
This class provides an interface for creating and managing actions in the ActionEngine V2 format. It includes methods for setting up input and output nodes, calling the action, and running the action handler. 
|  | 
|  | Action (ActionSchema schema, std::string_view id="", std::vector< Port > inputs={}, std::vector< Port > outputs={}) | 
|  | Constructor. Creates an action in the context given by node_map,stream, andsession.
 | 
|  | 
| ActionMessage | GetActionMessage () const | 
|  | Makes an action message to be sent on a WireStream. 
 | 
|  | 
| AsyncNode *absl_nullable | GetNode (std::string_view id) | 
|  | Gets an AsyncNode with the given idfrom the node map.
 | 
|  | 
| AsyncNode *absl_nullable | GetInput (std::string_view name, std::optional< bool > bind_stream=std::nullopt) | 
|  | Gets an AsyncNode input with the given name from the node map. If no input with the given name is found, returns nullptr. 
 | 
|  | 
| AsyncNode *absl_nullable | GetOutput (std::string_view name, const std::optional< bool > bind_stream=std::nullopt) | 
|  | Gets an AsyncNode output with the given name from the node map. If no output with the given name is found, returns nullptr. 
 | 
|  | 
| void | BindHandler (ActionHandler handler) | 
|  | Sets the action handler. 
 | 
|  | 
| NodeMap *absl_nullable | GetNodeMap () const | 
|  | 
| void | BindStream (WireStream *absl_nullable stream) | 
|  | Binds a given stream to the action. 
 | 
|  | 
| WireStream *absl_nullable | GetStream () const | 
|  | 
| void | BindSession (Session *absl_nullable session) | 
|  | Binds a session to the action. 
 | 
|  | 
| Session *absl_nullable | GetSession () const | 
|  | 
| std::unique_ptr< Action > | MakeActionInSameSession (std::string_view name, std::string_view action_id="") const | 
|  | Makes a different action in the same session. Should be used to create nested actions. 
 | 
|  | 
| ActionRegistry *absl_nullable | GetRegistry () const | 
|  | 
| std::string | GetId () const | 
|  | 
| absl::Status | Await (absl::Duration timeout=absl::InfiniteDuration()) | 
|  | Block until the action has been completed, either by being run or called. 
 | 
|  | 
| absl::Status | Call () | 
|  | Calls the action by sending an ActionEngine action message to associated stream. 
 | 
|  | 
| absl::Status | Run () | 
|  | Run the action handler. Clients usually do not call this method directly. 
 | 
|  | 
| void | ClearInputsAfterRun (bool clear=true) | 
|  | Specifies whether the action should delete its input nodes from its bound node map after it's run. 
 | 
|  | 
| void | ClearOutputsAfterRun (bool clear=true) | 
|  | Specifies whether the action should delete its output nodes from its bound node map after it's run. 
 | 
|  | 
| void | Cancel () const | 
|  | Cancels the action and all its inputs. 
 | 
|  | 
| thread::Case | OnCancel () const | 
|  | Returns a thread::Case that handlers can use to synchronise with cancellation. 
 | 
|  | 
| bool | Cancelled () const | 
|  | Returns whether the action has been cancelled. 
 | 
|  | 
  
  | 
        
          | act::Action::Action | ( | ActionSchema | schema, |  
          |  |  | std::string_view | id = "", |  
          |  |  | std::vector< Port > | inputs = {}, |  
          |  |  | std::vector< Port > | outputs = {} ) |  | explicit | 
 
Constructor. Creates an action in the context given by node_map, stream, and session. 
Creates an action with the given schema, handler, ID, node map, stream, and session. The ID is generated if not provided, and other parameters are nullable, and if not provided, restrictions apply, however, it makes the Action class unified for client and server-side usage.
- Parameters
- 
  
    | schema | The action schema. Required to resolve input and output node types, as well as to create the action message on call. |  | id | The action ID. If empty, a unique ID will be generated. |  | inputs | A mapping of input names to node IDs. If empty, the IDs will be generated based on the schema. |  | outputs | A mapping of output names to node IDs. If empty, the IDs will be generated based on the schema. |  
 
 
 
      
        
          | absl::Status act::Action::Await | ( | absl::Duration | timeout = absl::InfiniteDuration() | ) |  | 
      
 
Block until the action has been completed, either by being run or called. 
If previously Run(), this method waits on a condition variable until the action handler has completed and returns the resulting status.
If previously Call()-ed, this method waits until the status arrives to a special reserved output node named "__status__", and returns it.
- Returns
- The status returned by the action handler, or the error status if the handler failed. 
 
 
  
  | 
        
          | void act::Action::Cancel | ( |  | ) | const |  | inline | 
 
Cancels the action and all its inputs. 
This method will cancel all input nodes and notify the action handler that the action has been cancelled. It is safe to call this method multiple times, as it will only notify once.
Cancelling input nodes means stopping background prefetcher fibers and setting reader status to Cancelled. Any cached data will still be available to the action handler, but no new data will be fetched.
Any output nodes will not be cancelled, as they do not introduce blocking behavior in the action handler. It is the handler's responsibility to check for cancellation and stop processing if needed. However, if the handler terminates with an error, non-OK statuses will be sent to the output nodes.