Skip to content

Proposal to Clean up/Update the CDI API. #38

@klihub

Description

@klihub

The current CDI implementation (API) has a number of issues that should be fixed. Among other things:

  • API oddities:
    • (exported) functions with arg types that have no functions to acquire instances of those types (e.g. Spec)
    • implementation vs. original intention
      • injection of other than fully qualified types (sometimes) possible, but should not be
      • normal /dev-entries can be 'virtualized', but should not be
    • irregularities (some functions can survive /dev node node names while others error out on them)
  • missing functionality
    • injection (or easy querying of) all devices (matching a vendor/class)
  • designed for client-side device injection
    • inefficiencies: no caching, CDI directory, Specs rescanned for every single call
    • no atomicity: same as above, with two function calls you can't be sure if you're still operating on the same data set
    • resiliency: an error (syntactic or semantic likewise) causes every operation to fail

There are ongoing efforts to implement CDI device resolution in the runtimes (containerd pull req., draft-NRI plugin), so it would be nice to address most of these issues.

Here is a proposal for an updated API.
It has an almost full implementation of the proposed API.
This is how the API itself looks like.
This commit message lists the proposed functionality.
The proposal also containes a small cobra-based utility which both demonstrates how to use more than just the most basic trivial functions of the API and also allows one to inspect/play around with CDI Specs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions