Skip to content

Adapter: expose diag_api::DataResource as opensovd_core::DataProvider (native SOVD backend for the gateway) #16

Description

@FScholPer

What

PR #6 integrates the OpenSOVD gateway (opensovd_core) and the CDA as Bazel dependencies. The gateway currently serves demo data via DataProviderBuilder + Constant. The Rust diagnostic API (score/mw/diag/api, merged in PR #2) provides the app-facing DataResource trait (plus uds_adapters that already expose UDS RDBI/WDBI/RoutineControl as DataResource/SimpleOperation).

What is missing is the seam that lets the gateway serve real diag_api resources instead of demo constants.

Goal

A thin, in-process Rust adapter (no FFI) that implements opensovd_core::DataProvider backed by a registry of diag_api::DataResource instances, and wire it into the gateway host in place of the demo providers.

Scope / Tasks

  • New adapter type implementing opensovd_core::DataProvider:
    • list() / categories() / groups() derived from DataResourceMetadata (id, name, category, groups, read_only)
    • read(data_id, include_schema) → dispatch to DataResource::read, convert ReadValueReply (encoding/JSON) → serde_json::Value / Data
    • write(data_id, value) → DataResource::write
    • error mapping diag_api common::Error / DataError ↔ opensovd_models ErrorCode / DataError
      async: await ReadValueHandle / WriteValueHandle (ready / future / closure) inside the async fn
      A registration API to add DataResources (with metadata) to a Component's provider.
      Wire the adapter into score/opensovd-gateway/src/main.rs (replace Constant demo providers).
      Unit + integration tests (query the running gateway via opensovd-client, mirroring the existing CDA integration test).

Acceptance Criteria (DoD)

  • A DataResource registered through the adapter is readable/writable over SOVD/REST via the gateway (/sovd/... components/.../data/...).
  • UDS-backed resources (via existing uds_adapters) are served without extra code.
  • Categories/groups/tags reflect DataResourceMetadata.
  • Tests green in CI (Bazel score_diag_x86_64_linux).

How

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status
Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions