Class OperationProvider
Defined in File operation_provider.hpp
Class Documentation
-
class OperationProvider
Provider interface for entity operations.
Typed provider interface for plugins that serve SOVD operations (GET /{entity_type}/{id}/operations, POST /{entity_type}/{id}/operations/{name}). Per-entity routing like DataProvider.
See also
GatewayPlugin for the base class all plugins must also implement
See also
DataProvider for the data counterpart
- Thread safety
All methods may be called concurrently. Implementations must synchronize.
Public Functions
-
virtual ~OperationProvider() = default
-
virtual tl::expected<dto::Collection<dto::OperationItem>, OperationProviderErrorInfo> list_operations(const std::string &entity_id) = 0
List available operations for an entity.
Returns a typed
Collection<OperationItem>. The wire shape is unchanged from the pre-typed ABI ({"items": [...]}plus optionalx-medkit/_links); JsonWriter<Collection<OperationItem>> emits identical bytes.- Parameters:
entity_id – SOVD entity ID
-
inline virtual tl::expected<dto::OperationItem, OperationProviderErrorInfo> get_operation(const std::string &entity_id, const std::string &operation_name)
Get a specific operation by name.
Returns the bare
OperationItem(without the{"item": ...}envelope); the gateway handler wraps it into the SOVDOperationDetailresponse on the wire.Note
Default implementation calls list_operations + linear scan. Override for O(1) lookup in plugins with many operations.
- Parameters:
entity_id – SOVD entity ID
operation_name – Operation name
-
virtual tl::expected<dto::OperationExecutionResult, OperationProviderErrorInfo> execute_operation(const std::string &entity_id, const std::string &operation_name, const nlohmann::json ¶meters) = 0
Execute an operation.
Returns a typed
OperationExecutionResultenvelope around the plugin-defined response object. JsonWriter emitscontentverbatim, so the wire bytes are byte-identical to the pre-typednlohmann::jsonABI. The payload shape is plugin-determined (ROS service / action result, OPC-UA method result, …) and the OpenAPI schema is opaque (x-medkit-opaque:true).- Parameters:
entity_id – SOVD entity ID
operation_name – Operation name (e.g., “session_control”)
parameters – JSON parameters from request body