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<nlohmann::json, DataProviderErrorInfo> list_data(const std::string &entity_id) = 0

List available data resources for an entity

Parameters:

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

Returns:

JSON with {“items”: […]} array of data resource descriptors

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

Read a specific data resource

Parameters:
  • entity_id – SOVD entity ID

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

Returns:

JSON response body for the data resource

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

Write a data resource value

Parameters:
  • entity_id – SOVD entity ID

  • resource_name – Data resource name

  • value – JSON value to write

Returns:

JSON response body confirming the write