Class DataProvider

Class Documentation

class DataProvider

Provider interface for entity data resources.

Typed provider interface for plugins that serve SOVD data resources (GET /{entity_type}/{id}/data, GET /{entity_type}/{id}/data/{name}). Unlike LogProvider/ScriptProvider (singletons), multiple DataProvider plugins can coexist - each handles its own set of entities.

Entity ownership is determined by IntrospectionProvider: entities created by a plugin’s introspect() are routed to that plugin’s DataProvider.

See also

GatewayPlugin for the base class all plugins must also implement

See also

OperationProvider for the operations counterpart

Thread safety

All methods may be called from multiple HTTP handler threads concurrently. Implementations must provide their own synchronization.

Public Functions

virtual ~DataProvider() = default
virtual tl::expected<dto::DataListResult, DataProviderErrorInfo> list_data(const std::string &entity_id) = 0

List available data resources for an entity.

Returns a typed DataListResult envelope around the plugin-defined response body. JsonWriter emits content verbatim, so the wire bytes are byte-identical to the pre-typed nlohmann::json ABI. The payload shape is plugin-determined (typically {"items": [...]} with per-item fields varying across backends - ROS topic metadata, OPC-UA node attributes, UDS DID descriptors, …). The OpenAPI schema is opaque (x-medkit-opaque:true).

Parameters:

entity_id – SOVD entity ID (e.g., “openbsw_demo_ecu”)

virtual tl::expected<dto::DataValue, DataProviderErrorInfo> read_data(const std::string &entity_id, const std::string &resource_name) = 0

Read a specific data resource.

Returns a typed DataValue envelope around the plugin-defined response body. JsonWriter emits content verbatim, so the wire bytes are byte-identical to the pre-typed nlohmann::json ABI. The payload shape is runtime-dependent (live ROS message, OPC-UA value with metadata, UDS DID payload, …) and the OpenAPI schema is opaque (x-medkit-opaque:true).

Parameters:
  • entity_id – SOVD entity ID

  • resource_name – Data resource name (e.g., “hardcoded_data”)

virtual tl::expected<dto::DataWriteResult, DataProviderErrorInfo> write_data(const std::string &entity_id, const std::string &resource_name, const nlohmann::json &value) = 0

Write a data resource value.

Returns a typed DataWriteResult envelope around the plugin-defined response body. JsonWriter emits content verbatim, so the wire bytes are byte-identical to the pre-typed nlohmann::json ABI. The payload shape is plugin-determined (typically {"status": "ok"} or similar) and the OpenAPI schema is opaque (x-medkit-opaque:true).

Parameters:
  • entity_id – SOVD entity ID

  • resource_name – Data resource name

  • value – JSON value to write